<> The information you provide in the prompt fields on the Global Settings window are used throughout the application. These affect source code generation for the Global CODE section of the application, and the generated source code for all procedures. Property Fields < Enable Shared Files> [û] Enable Shared Files Check this box to indicate that the application will be used in a multi-user environment. This could be a Network, Multi- user operating system, or a single-user Multi-tasking operating system. When checked, all data files in the application are OPENed in shared access mode 42h (Read/Write Deny None) instead of exclusive access mode 22h (Read/Write Deny Write). < Enable Mouse Support> [û] Enable Mouse Support Check this box to indicate that the application will allow the user to use a mouse. This places a SETMOUSE(1,1) statement in the Global CODE section. < Enhanced Background?> [û] Enhanced Background? Check this box to indicate that the application will be run on an EGA, VGA, or SVGA monitor which allows the Blink bit to be used as background color Enhance bit (see SETNOBLINK in the Language Reference). < Close Unused Files?> [û] Close Unused Files? Check this box to indicate that each procedure should close the data files which it opens. When this box is checked, CheckOpen() is generated as a FUNCTION returning one (1) if it actually opened the file, or zero (0) if the file was already open or unable to be opened. If not checked, CheckOpen is generated as a PROCEDURE. The return value from the CheckOpen() function is saved in a local variable by each procedure. That saved value is checked just before RETURN to its calling procedure -- if the procedure opened the file, it also closes the file. < If File Not Found:> If File Not Found: Select the action to take when the application attempts to open a non-existing data file. () Create -- Attempts to CREATE the file () Halt -- Displays a warning then returns to DOS. < Program Author:> Program Author: Enter the programmer's name for documentation purposes. Embedded Source < Inside Global MAP> "Inside Global MAP" In the Global data section of the program at the end of the MAP structure. This may be used to declare any Global procedure prototypes (or INCLUDE a file containing them) that the Application Generator does not automatically include in the MAP. < Before File Declarations > "Before File Declarations" In the Global Data section of your program, after the MAP and %GlobalData (Data declared in the Data Button of Application Properties), and before the file declarations. This source can be used to declare any variables that you didn't desire to declare as part of %GlobalData, or variables that don't need to be visible in the Generator. The placement of this #EMBED allows the declarations made here to be visible to your File Declarations. Example: You have twenty files, each of which uses a variable as the file location. You could either declare each variable in the Global Data button, or use this EMBED to write one, declaration, copy it 20 times, and make the to the copies. < Data Section > "Data Section" In the Global data section of the program after Global data and all data file definitions. This may be used to declare any Global data which you may want to use only in your embedded source code. < Setup Program> "Setup Program" Immediately after the CODE statement. < Before Return to DOS> "Before Return to DOS" After the call to the first procedure and immediately before the RETURN statement which takes the user back to DOS. <> The "Batch" template generates a procedure which will loop through a file and perform an operation on each record. This template is designed to allow changing or deleting a group of records with no hand coding. However, there are many embedded source code points to give the programmer maximum flexibility. CAUTION: It is a very good idea to make a backup copy of your data files before running a batch Change or Delete and NEVER test these procedures on live data without first making a backup. Formatter Support The Screen Formatter contains a default screen design containing two display fields, and Ok and Cancel buttons. The Pulldown Menu Formatter and Report Formatter are not supported. Property Fields < Range Limit Field> Range Limit Field: The range of records to be processed can be limited by fixing the value of a component of the primary file access key. For example, line items on an invoice can be limited to a single invoice. The key for the item file might contain ITM:Invoice and ITM:Line containing the invoice number and line number of the item. ITM:Invoice would be the Range Limit Field, displaying only those records for a fixed invoice number. The Range Limit Field will be assigned the Range Value Field for this limit. < Range Value Field> Range Value Field: The Range Value Field is the field which holds the value to be used as the limiting key component value. The key component will be assigned this value. In this example, the current Invoice record might contain the number of the invoice that is being displayed. INV:Number would be the Range Value Field, supplying the value for the Range Limit Field. The Range Value Field must not be the same field as the Range Limit Field. < Record Filter> Record Filter: You may enter a record filter expression here. If the Delete action is selected, and you enter CUS:State = 'FL' as the filter, then all customers with the state code of 'FL' will be deleted. No validation is done on the code you enter -- an invalid expression will generate compiler errors. If you are not familiar with the Clarion language statements or expressions, do not use this entry -- use a Formula field with the FILTER Formula Class instead. < Action for Batch> Action for Batch: The batch process may either change or delete records. 'Change' will PUT each selected record. 'Delete' will DELETE each selected record. 'No Action' will not PUT or DELETE the records. < Show Record Counter> Show Record Counter: Check this box to display a record counter as the records have been successfully changed or deleted. Displaying a variable on screen within the main process LOOP can slow the batch process slightly. Therefore, you may leave this check box blank and have no screen updates within the LOOP. Embedded Source < Data Section > "Data Section" In the data section of the procedure after local data, the screen and pulldown structures. This may be used to declare any data which you may want to use only in your embedded source code. < Setup Procedure> "Setup Procedure" Immediately after the CODE statement. < Setup Screen> "Setup Screen" After the OPEN(Screen) statement. < Before file SET() > "Before file SET()" Before the SET which will determine the file processing order. This embedded source is the ideal place to fill key values for a multiple component key SET. < Before LOOP > "Before LOOP" After the SET command but before the main LOOP. At this location you may override the SET statement, or enter any LOOP setup code. < NEXT Record Error Check > "NEXT Record Error Check" Immediately after the NEXT command. This allows a check of the ERRORCODE() function to insure that there were no errors. WARNING: If no error check is made here to allow a BREAK out of the loop, you WILL get an infinite loop! < Within LOOP > "Within LOOP" After the GET to any secondary files. This is the heart of the processing LOOP. If using a record filter, this code may not always be executed if the record is filtered out. If Many to 1 relationships exist in the File Schematic, the lookups will have already been done. Any formulas created with the formula formatter (except FILTER) will have been executed just prior to this embedded source code. The next statement which executes after this code is the PUT or DELETE of the record if Change or Delete has been selected for this batch. < PUT/DELETE Record Error Check > "PUT/DELETE Record Error Check" Immediately after the PUT or DELETE commands. This allows a check of the ERRORCODE() function to insure that there were no errors replacing a record. If you are changing fields which are the components of unique keys, or if you are running this batch process on shared files, you may enter your own error handling scheme here. If 'No Action' was selected for this batch process, this embedded code window is not needed. < End of Procedure > "End of Procedure" Code placed in this window executes after all other code in the procedure has executed. At this point, the Report is closed. This code begins in column one, therefore you may use this window to write any ROUTINEs which are called from any other embedded source code window. < When Screen Field is Selected : > "When Screen Field is Selected : " In the CASE SELECTED() structure, executed when the field is selected for entry. < When Screen Field is Completed: > "When Screen Field is Completed: " In the CASE FIELD() structure, executed when the field has been completed. Formula Classes < FILTER > FILTER A Conditional Field with "FILTER" in the Formula Class field is used to select which records are processed. If the Condition expression evaluates to zero (false) for a given record, it is not processed. < No class (blank) > No class (blank) Calculates the formula every time a record is processed. <> Brief Description ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ The "Browse" template uses a "List box" to display a scrollable list of records. The default Browse screen has "Add", "Change" and "Delete" pushbuttons which call an "Update" procedure to allow users to update a data file, and a "Select" button to allow users to "Select" a record from the list. The "Select" button is dimmed unless the Browse procedure is called as a "lookup" from an entry field. < Condensed Explanation of Prompts> Condensed Explanation of Prompts ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³Prompt ³ Explanation ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ Module Name : Name of the .CLA source file where this procedure is generated. Range Limit Field : Name a KEY field used to "limit" the records shown in the List box. The field must be a component of the Browse "Access Key". Records are included in the Browse if they have a KEY value which matches the value of this field. Range Value Field : If you name a field here, then records are included in the Browse if the "Range Limit" field contains a value EQUAL to the "Range Value" field. Record Filter : Enter a valid Clarion language expression. Record filters are used to Browse a subset of the data file. Each record from the data file will be evaluated against this expression for inclusion in this list. Locator Field : A Locator field is used to position the highlight bar to a particular section of the data file. Name a KEY field component of the Browse "Access Key". The Locator field should be placed on the Browse Screen as an Entry field AFTER the List box. The closest match to this field is found after the user hits the TAB key. *If your Locator field is a Numeric field, you should add the 'B'; to blank if zero, to the picture token. [û] Incremental Locator : Check this box if you want the "Locator field" to be activated each time the user enters a keystroke. The Locator remains active while the List box is selected. The "Locator" field MUST be placed AFTER the List box in the Field List. Any user keystrokes are used to immediately seek the closest match in the data file, and re-position the highlight bar in the List box. *If your Locator field is a Numeric field, you should add the 'B'; to blank if zero, to the picture token. Update Procedure : Name a procedure that is called when the user hits the "Add", "Change", or "Delete" pushbuttons. [û] Enable Hot Records : Check this box if you want the Browse procedure to re-read the data file record every time the highlight bar is moved. Use this option if you place data fields outside the List box. For example you could use this option if you want to display a MEMO field for the highlighted record. You can also use this option if you are using a Hotkey or Pushbutton to call another procedure, that acts upon the highlighted record. [û] Enable Total Embeds : Check this box if you have used any of the following Embedded Source points to calculate totals from the data file: "Set to First Record Before Total Loop" "Inside Total Loop, Immediately After Next()" "Inside Total Loop, After Filter" Code is generated to read the data file, and execute the embedded source code prior to the List box being displayed. To keep the total accurate when a user ADDs, CHANGEs, or DELETEs a record, you also need to add code to the Embed points: "Prior to Update Procedure" "After Update Procedure" [û] Disable Memo Access : Check this box if the data file has a Memo field, and you are not displaying the Memo on the Browse screen. This improves performance when scrolling the List box. Detailed Description ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ The "Browse" template generates a procedure to display records from a data file in a List box. Each line in the List box displays fields from one record of the data file. Each line in the List box can be scrolled left or right using the arrow keys or the List box horizontal scroll bar. Records are displayed in the List box in KEY order. The KEY that is used is identified as the "Access Key" on the File Schematic dialog (accessed by the "Files" pushbutton). The List box isn't filled with records until it is selected. You can place Fields before the LIST box, but the first page of records isn't displayed until the List box is selected. The "Insert", "Change", and "Delete" pushbuttons, or any other field that processes a record selected from the List box must be placed after the LIST box in the field list. To see the order Fields will be processed for your screen, enter the Screen Formatter and type Ctrl-F. The "Select" button is activated if the Browse is called with KEYCODE() set equal to ShftEnter (Shift and Enter). KEYCODE() is set equal to ShftEnter when a Procedure is called from an entry field, from either "When Field is Selected" or "When Field is Completed", AND you have named a "Return Field". < Range Limit Field: > Range Limit Field: ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ The "Range Limit" field allows a subset of the data file to displayed in the List box. The subset of records is based on the value contained in the "Range Limit" field. The "Range Limit" field is a component of the "Access Key". If you place the "Range Limit" field on the screen as an entry field, it allows the user to assign the KEY field a value and "limit" the records displayed. If you don't place the "Range Limit" field on the screen you will have to provide a value for the "Range Limit" in an Embedded Source point such as "Setup Screen". You can also use both "Range Limit" and "Range Value" fields. The value in the "Range Value" field is assigned to the "Range Limit" field when the Browse is started. < Example using a Range Limit as an Entry field:> Example using a Range Limit as an Entry field: ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ If you have two files; INVOICE and ITEMS, and you want to Browse all ITEMS for a selected INVOICE, you can "limit" the records shown in the Browse of the ITEMS file. If the Browse "Access Key" for the ITEMS file looks like this: ITM:InvoiceKey !Key for ITEMS file ÃÄ ITM:InvoiceNo !Invoice Number ÀÄ ITM:Line !Line number on Invoice To "Browse" the ITEMS for a single Invoice, select ITM:InvoiceNo as the "Range Limit" field. Now place ITM:InvoiceNo as an Entry field on the Browse screen before the List box. When the Browse is executed the user can enter an Invoice number, and after hitting the TAB key, the List box will be filled with ITEMS for the Invoice number the user entered. If the Browse "Access Key" is a multi-component KEY, and you want to use the entire KEY to limit the Browse, select the last component of the KEY as the "Range Limit" field. If you place all the KEY fields on the screen as entry fields, the Browse can be "limited" by the user at runtime. Alternatively, you can use the embedded source code window "Setup Screen", to prime the KEY components. < Example of Range Limit using Embedded Source:> Example of Range Limit using Embedded Source: ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ The INVOICE file has the following KEY: INV:InvoiceKey !Key for INVOICES file ÃÄ INV:InvoiceNo !Invoice Number ÀÄ INV:Date !Date of Invoice You can use the Embedded Source window "Setup Screen", to assign a value to the "Range Limit" field. Given the above KEY for the INVOICE file, you can Browse the INVOICE file, and display only the INVOICES that were entered for a specific date. To view all invoices for "today" in the embedded source window "Setup Screen", you would enter: INV:Date = TODAY() < Range Value Field: > Range Value Field: ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ The "Range Value" field is used in conjunction with the "Range Limit" field. When a Browse is started, the value in the "Range Value" field is assigned to the "Range Limit" field. This "limits" the Browse without having to place the "Range Limit" field on the Browse screen. The "Range Value" field is typically assigned a value by the procedure which calls the Browse. The "Range Value" field cannot be the same field as the "Range Limit" field. < Example of a Range Value Field> Example of a Range Value Field ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ You want to let the user Browse the INVOICE file, select an Invoice, and then Browse the ITEMS for the selected Invoice. The Browse "Access Key" for the ITEMS file looks like this: ITM:InvoiceKey !Key for ITEMS file ÃÄ ITM:InvoiceNo !Invoice Number ÀÄ ITM:Line !Line number on Invoice The INVOICE file has the following KEY: INV:InvoiceKey !Key for INVOICES file ÃÄ INV:InvoiceNo !Invoice Number ÀÄ INV:Date !Date of Invoice Enter the "Range Limit" field as ITM:InvoiceNo, and enter the "Range Value" field as INV:InvoiceNo. The Browse of the ITEMS file is "limited" to the value of ITM:InvoiceNo, which receives its value from the "Range Value" field; INV:InvoiceNo. The Browse of the INVOICE file is executed as a "lookup" by entering the following code in the "Setup Procedure" Embedded Source point: SETKEYCODE(ShftEnter) ! call the Browse with the ! "Select" button active The Browse of the INVOICE file allows the user to highlight an Invoice record, then hit the "Select" button. The "Select" button is used to call the Browse of the ITEMS file. When the Browse for ITEMS is executed, INV:InvoiceNo is assigned to ITM:InvoiceNo. The List box is filled with ITEMS for the INVOICE the user selected. < Record Filter: > Record Filter: ÄÄÄÄÄÄÄÄÄÄÄÄÄÄ You can display a subset of a data file using either the "Range Limit" field, or a Record Filter. If the subset of the file is based on a field value which is a component of the "Access Key" for the Browse, then the "Range Limit" field will provide the fastest performance. If the subset of the file is based on a field which is not a component of the "Access Key" then you will need to use a record filter. You can use BOTH a "Record Filter:" and a "Range Limit" field. This will give you the performance of a "Range Limited" Browse, but allow you to display a subset of those records. There are 2 methods you can use to enter a record filter: Method #1. You can use the Formula Generator to create a formula, and enter a Formula Class of 'FILTER'. The code generated will "FILTER' the file based on your formula. Method #2. The "Record Filter:" entry field on the Browse Procedure Properties dialog allows free-form entering of a record filter expression. The code entered here will not be validated before a compile. Those who are not fully familiar with the Clarion Language should use the Formula Generator instead of this entry field. < Locator Field: > Locator Field: A locator field is a screen entry field that updates a component of the primary file access key. When a locator field is entered, the closest matching record is displayed in the list box. The Locator field is usually placed after the List box in the Field order list, you can check this using Ctrl-F in the Screen formatter. Placing the Locator after the List box allows the List box to be filled as soon as the Browse is called, if the Locator is placed before the List box the List will not be filled until the user TABS off the List box. For example, scrolling a vendor file in vendor name sequence uses a key that contains the vendor name field (e.g. VND:Name). To create a vendor name locator field, place a VND:Name entry field on the screen before or after the list box, and enter VND:Name for the Locator Field on the Browse Property Screen. At runtime, when the user is scrolling the List box, typing any character on the keyboard selects the locator field, and allows entry for the match. Pressing the Tab key positions the highlight bar to the closest match. *If your Locator field is a Numeric field, you should add the 'B'; to blank if zero, to the picture token. < Incremental Locator > [û] Incremental Locator Check this box to indicate that the Locator Field will act function as an "Incremental Locator". You MUST place the "Locator" field AFTER the List box in the Field List, for the incremental search to work correctly. This template option allows one-half second delay for the user to type a new letter into the locator field. At each pause longer than one-half second, the Locator contents are used to locate the closest match (the Tab key does not need to be pressed). The backspace key is active during this process, and reverses the search. *If your Locator field is a Numeric field, you should add the 'B'; to blank if zero, to the picture token. < Update Procedure: > Update Procedure: Enter the name of the update procedure to be used to insert, change, or delete records. If no update procedure is entered, the "Insert", "Change", and "Delete" pushbuttons should be removed from the screen layout. < Enable Hot Records: > [û] Enable Hot Records: Fields from the file being scrolled can be placed outside the List box. The fields will display values from the record that is highlighted in the List box, and are updated whenever the highlight bar is moved. Hot fields should be set as "Display only" when placed on the screen. If "Enable Hot Records" is checked, every movement of the highlight bar reads the record from the Primary file into memory. Next, lookups to the "ONE" side of any Many:1 relations are performed. Any FORMULAs which do not have a formula class set to (FILTER,AVG,SUM or CNT) are then executed. Finally, any embeddded source code which was entered in the 'Process Selected Record' code window is executed. < Enable Total Embeds > [û] Enable Total Embeds Check this box to generate total field code, without the need for dummy formula fields. Otherwise, you must define a total field with a formula class of SUM, CNT or AVG. < Disable Memo Access > If the file being "Browsed" has a Memo field you can improve the performance of the Browse procedure by turning off the reading of memo fields. < Locator fields > Locator fields ÄÄÄÄÄÄÄÄÄÄÄÄÄÄ You can place an optional "Locator" field on the Screen that lets users find a specific record in the file. If the user types any letter while scrolling the LIST box control goes to the Locator field. The Locator field is completed with either the TAB key or a mouse CLICK outside the Locator field. Once the "Locator" is completed the BROWSE procedure displays the closest matching record at the first row of the List box. *If your Locator field is a Numeric field, you should add the 'B'; to blank if zero, to the picture token. < Incremental Locator fields > Incremental Locator fields ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ You can also define the "Locator" field as an "Incremental Locator". An "Incremental Locator" doesn't wait for the TAB or a mouse click to start the search for a matching record, instead every half-second a search is made for the closest match to the contents of the Locator field. So if the user types "S" the first record with "S" is displayed on the first line of the List box. If the user then types "M" a search is made for "SM" and the List box is scrolled to that record. Typing a "Y" starts a search for "SMY", and so on. Pressing the backspace key will reposition the highlight bar in reverse order. For numeric data types, it is recommended to use a string picture type (for display purposes). Date fields are not recommended for incremental locators. *If your Locator field is a Numeric field, you should add the 'B'; to blank if zero, to the picture token. < Averages> < Counts> < Sums> < Counts> Use a Formula field with Formula Class of "SUM" to apply the formula to every record in the Browse session. A Computed Field with "AVG" in the Formula Class field calculates the average for the records included in the Browse session. A Computed Field with "CNT" in the Formula Class field counts the records included in the Browse session. Totals that use a Conditional Formula are calculated based on the Formula Condition. See the Topic "Formula Classes" for more details. < Recalculating Totals> If you are using Embedded Source to calculate totals, you can call the ROUTINE InitializeTotals, in the EMBED point "After Update Procedure" to re-calculate your totals. The ROUTINE InitializeTotals is generated if you have checked "Enable Total Embeds", or you have a Formula field with the CLASS of SUM, CNT, or AVG. For example: IF UpdateSuccessful = True !if the file was updated DO InitializeTotals ! recalculate totals END < Browsing Fields from related files > Browsing Fields from related files ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ The Browse procedure will "lookup" fields in a file on the "One" side of a Many:1 relationship from the file being viewed in the List box. For example, if you have two files, Customers and Orders. The relationship from Customers to Orders is 1:Many, one Customer may have many Orders. If you create a Browse to view the Orders file, you can place a field from the Customer file in the List box, and the Browse procedure will automatically do the "lookup" into the Customer file. < Default Pushbuttons Insert,Change,Delete,Select> Update Procedure, Default Pushbuttons ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ The "Insert", "Change", and "Delete" pushbuttons call an update procedure to process the highlighted record (update procedures are normally created with a "Form" or "MultiPage" template). The name of the procedure is entered as the "Update Procedure" on the Browse procedure property screen. If you do not name an "Update Procedure" these pushbuttons have no default action. If all three pushbuttons are deleted and you have named an Update Procedure, the INSERT, ENTER and DELETE keys will still call the Update Procedure. However, if you only remove one or two of these buttons (Insert, Change, or Delete) no Update Procedure will be called for the removed button(s). The "Exit" pushbutton has an edit procedure defined as "RETURN", so when the user hits "Exit" the user is returned to the calling procedure. You may remove the "Exit" button, but some other provision must be made to return from the procedure. < Select pushbutton> < Calling a Browse to Lookup a value> The "Select" pushbutton is used when a Browse procedure is called as a "lookup". The "Select" button is dimmed unless the Browse is called with KEYCODE() set to ShftEnter (Shift and Enter keys together). If you won't be using the Browse procedure for lookups, you can delete this button. When the user presses the "Select" button the record highlighted in the List box is loaded into memory, and the program returns to the calling procedure. < Runtime Browse Navigation keys > Runtime Browse Navigation keys ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ At runtime, when the List box is selected a highlight bar is always positioned over a single record in the List box. The Up and Down arrow keys move the highlight bar. Moving the highlight bar up off the top row or down off the bottom row scrolls a new record into the list box. The PGUP and PGDN keys scroll the prior and next page of records into the list box. CTRL-PGUP displays the first page of records and CTRL-PGDN displays the last page of records. Pressing the right mouse button in the top half of the List box scrolls up and in the bottom half scrolls down. < Local Data > Local Data ÄÄÄÄÄÄÄÄÄÄ If you use the "Data" button on the procedure properties screen local data is generated before the screen structure. If you use the Embedded source point "Data Section" the data is generated after the Screen structure. < Pulldown Menu > Pulldown Menu ÄÄÄÄÄÄÄÄÄÄÄÄÄ If a pulldown structure has been created in the Pulldown Menu Formatter, it is generated after the screen structure. The template makes no provision for opening or closing a pulldown menu. Such statements must be entered as embedded source. Formatter Support ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ The "Browse" procedure in CLARION.APP is pre-loaded with a screen layout containing a list box and pushbuttons named "Insert", "Change", "Delete", "Select", and "Exit". The field equate label of the list box MUST be "?List" and the "Immediate" attribute MUST be on turned on. The horizontal scroll bar can be turned off if the required information fits in the list box. The vertical scroll bar is ignored by the template. The list box may not have an edit procedure. All other properties of the list box can be changed. The Report Formatter is not supported. Property Fields ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ Embedded Source < Data Section> "Data Section" In the data section of the procedure after local data, the screen and pulldown structures. This may be used to declare any data which you may want to use only in your embedded source code. < Setup Procedure> "Setup Procedure" After the CODE statement. < Setup Screen> "Setup Screen" After OPEN(Screen) statement. < Setup Pulldown> "Setup Pulldown" After OPEN(PullDown) statement. < Set to First Record Before Total Loop> "Set to First Record Before Total Loop" After the SET(key,key) for Range limits before beginning the total calculation LOOP. < Inside Total Loop, Immediately after NEXT> "Inside Total Loop, Immediately after NEXT" Immediately after each record is read in the total calculation LOOP. < Inside Total Loop after Filter> "Inside Total Loop after Filter" After each record is read and filter conditions are evaluated in the total calculation LOOP. < After Total Field Loop> "After Total Field Loop" After all totals have been calculated. < LIST Class Formula> "LIST Class Formula" After generation of LIST class formulas. This embedded code window may be used instead of LIST class formulas. This will allow setting up any fields which are displayed within the scrolling listbox. < Case of No Records Found> "Case of No Records Found" When no records are found to display. < After Filter and Range Check> "After Filter and Range Check" After any record filter or Range limits are evaluated. < End of General Formulas> "End of General Formulas" When processing a screen field, the formulas which do not have a class of 'FILTER' or 'LIST' will be generated. This embedded source window allows the entry of computations for screen display fields without the use of the Formula Formatter. < Set to First Record> "Set to First Record" When using Range Limits, a SET statement is issued to locate the first record. This embedded source code window appears just after the generated SET statement and allows you to override the SET. < Set to Last Record> "Set to Last Record" When using Range Limits, a SET statement is used to locate the closest match to the last record. This embedded source code window appears just after the SET and allows you to override the SET. < Process Selected Record> "Process Selected Record" When Enable Hot Records has been checked, code within this embedded source window is executed upon any movement of the list box highlight bar. The highlighted record is retrieved into memory, any Many to One secondary file records are retrieved, and any general formulas are computed just prior to this embedded source code. < End of Procedure> "End of Procedure" Code placed in this window executes after all other code in the procedure has executed. This code begins in column one, therefore you may use this window to write any ROUTINEs which are called from any other embedded source code window. < Prior to Update Procedure> "Prior to Update Procedure" Immediately before the Update Procedure is called. < After Update Procedure> "After Update Procedure" Immediately after return from the Update Procedure. < When Screen Field is Selected : > "When Screen Field is Selected : " In the CASE SELECTED() structure, executed when the field is selected for entry. < When Screen Field is Completed: > "When Screen Field is Completed: " In the CASE FIELD() structure, executed when the field has been completed. Formula Classes < FILTER > FILTER A Conditional Field with "FILTER" in the Formula Class field is used to display a subset of the datafile. If the "IF Condition" expression evaluates to false for a given record, it is not displayed. Enter the expression for the "IF Condition" field and leave the "True Formula" and "False Formula" fields blank. Only the Expression will be used for the filter. A filter expression can alternatively be entered in the Browse Procedure Property entry field "Record Filter: ", instead of using the formula generator. < LIST > LIST A Conditional or Computed Field with "LIST" in the Formula Class field is used for those values which will be displayed in the list box and are only evaluated when the list box item is created. < SUM > SUM A Computed Field with "SUM" in the Formula Class field calculates the "Formula Field" using the "Formula Expression". The code is generated as: FormulaFieldName$ += FormulaExpression A Conditional Field with "SUM" in the Formula Class field conditionally calculates the "Formula Field" using the "Formula Expression" contained in the fields named in the True and False Expressions. The code is generated as: IF CONDITION FormulaFieldName$ += the TRUE FormulaExpression ELSE FormulaFieldName$ += the FALSE FormulaExpression END < AVG > AVG A Computed Field with "AVG" in the Formula Class field calculates an Average of the field named in the Expression. The total value is calculated, then divided by the number of records read to achieve that total. < CNT > CNT A Computed Field with "CNT" in the Formula Class field counts the number of records included in the Browse session. < No class (blank) > No class (blank) Calculates the formula every time any field on the screen is completed. The calculation code is generated before the field edit routines at the top of the field processing code. <> The "Child" template creates a procedure which has a screen with features from both the Browse and Form templates. This template screen has both a scrolling area and a record update area. This template is designed to process a batch of child records as a single transaction. This batch of records must be in a file which is the child file in a parent-child relationship (the many side of a one-to-many relationship). When a Child Procedure is called, all of the related children records for the valid parent record in memory will be loaded into a memory QUEUE (the parent record must reside on disk as well as in memory). The QUEUE may be modified by adding, changing, or deleting records. Upon completion of the OK button, the QUEUE records are written back to disk as a single transaction. Changes to the QUEUE are discarded if the Exit button is selected. NOTE: Autonumbering keys are NOT supported in the CHILD Template. To use autonumbering keys, use a Browse- Form Pair for updates. In order to maintain the highest level of data integrity, the update of the child file is framed within a Transaction process. (See the essay on Transaction Processing in the Programmer's Guide for details.) The Btrieve and Clarion file drivers support Transaction Processing. So, the Child file must utilize one of these file drivers in order to work properly. For drivers which do not support transaction processing, a Browse-Form template combination may be used. The correct File Schematic is essential to the proper operation of a Child template procedure. By selecting the Files... button from the Procedure Properties screen you may view the existing file schematic, or create a new file schematic if one has not already been defined. The child file must be the first (primary) file in the File Schematic. The parent file must be listed below the child file, and must have a relationship defined with the child file as in the example below: This File Schematic is supported: --------------------------------- Primary (Child file) ÀÄÄ> Secondary (Parent file for Child) This File Schematic is NOT supported: ------------------------------------- Primary (Parent file) ÀÄ>> Secondary (Child file of Parent) The following is a check-list to help in creating a Child template procedure for the first time: - Create the File schematic as shown above (Child file first, then Parent file). Select an Access key from the Child file to be used for the listbox order. - In the Screen Formatter, place Scrolling fields from the child file in the list box, and Child file Entry fields in the area above the Save and Exit buttons. - Re-order the fields on the screen so that the entry area fields are consecutive. Remember which field is your first update field. Save the screen structure. - Fill out the First Update Field and Parent File Procedure Property fields. These fields are required. Formatter Support The Child template's default screen is pre-defined with two logically separate areas, a scrolling area and a field entry area. The scrolling area lists all children records for the selected parent. The standard list box keys are available to scroll through the child records. (See the Browse template's help for details.) Buttons below the list box allow the user to Insert, Change or Delete records. Also, an OK and Cancel button are active while in the scrolling portion of the screen. The field entry area is similar to a Form in operation. Entry fields are placed in this area to allow data entry for a child record. The fields in this area must be consecutive in the screen structure and must immediately precede the Save and Exit buttons as a block of fields is selectively ENABLE()'d and DISABLE()'d when moving back and forth between the scrolling area and the update area. The record may be saved to the list box using the Save button, or it may be erased by using the Exit button. The OK and Cancel buttons are only available while in the scrolling area. Once the OK button is completed, the entries in the QUEUE are written to disk within a transaction. If any error occurs, the entire set of records are rolled back to the status of the file before the OK button was completed and the user is given an opportunity to change any problem records and attempt a save again. If a Pulldown structure has been created by the Pulldown Menu Formatter, it is generated after the screen structure. The Pulldown is OPENed after the screen structure, and is closed upon exit from the procedure. The Report Formatter is not supported. Property Fields: < First Update Field> First Update Field: The Child template has 2 separate modes of operation. The template selectively disables fields which are not appropriate to the current mode. Scrolling Area - Only scrolling area field are available. Field Entry Area - Only entry specific fields are available. You MUST enter the First Update Field here. This should be the first entry field for the Child file. This is necessary to properly ENABLE() the range of fields in the screen structure from this field to the Exit pushbutton. If the fields are not consecutive in the Field List, the proper fields may not be ENABLEd or DISABLEd. The easiest way to insure consecutive entry fields is to Auto Re-order the screen fields just prior to saving the screen. < Parent File: > Parent File: The Parent File MUST be supplied to identify which Parent file to use for the relationship. The Child template is designed to handle the relationship between 1 Parent and 1 Child file. In order to insure that only 1 user in a multi-user environment may modify a batch of child records at a time, a HOLD is placed on the parent record. This will signal to other Child procedures that the children for this parent are currently being modified. Other procedures will be able to read the parent record, but will not be able to modify it. Therefore, it is important that when using a Child template procedure to modify a file's records, that there are no other procedures which may modify these child records. (Example: There must not be any Form template procedures which may modify a child file's record while it is being updated via a Child template.) < Exit on Null Parent:> Exit on Null Parent: Since the parent record information is critical to finding the correct children for a parent, you may select to RETURN from the child procedure when no parent record has been selected. You may enter embedded source code to select a parent record and leave this checkbox blank. < Update Parent on OK:> Update Parent on OK: With this checkbox enabled, the parent record is PUT back to its file upon completion of the OK button. This allows updating of any parent information which may have been changed while in the Child procedure. Embedded Source < Data Section> "Data Section" In the data section of the procedure after local data, the screen and pulldown structures. This may be used to declare any data which you may want to use only in your embedded source code. < Setup Procedure> "Setup Procedure" After the CODE statement. < Setup Screen> "Setup Screen" After OPEN(Screen). < Top of ACCEPT Loop> "Top of ACCEPT Loop" After LOOP statement and prior to generating formula fields. < Prior to Return> "Prior to Return" After exiting the main loop, but prior to freeing the Queue. This would be a good place to add code which needs to loop through the RecordQueue for information before exiting. < End of Procedure> "End of Procedure" Code placed in this window executes after all other code in the procedure has executed. This code begins in column one, therefore you may use this window to write any ROUTINEs which are called from any other embedded source code window. < Enter Scroll Mode Routine> "Enter Scroll Mode Routine" After the DISABLE and ENABLE of the fields to switch to the scrolling area from the entry field area. This is a good place to override the automatic enabling and disabling of fields. < Enter Update Mode Routine> "Enter Update Mode Routine" Also a good place to override the automatic enabling and disabling of fields, but when going to update mode. < When Screen Field is Selected : > "When Screen Field is Selected : " In the CASE SELECTED() structure, executed when the field is selected for entry. < When Screen Field is Completed: > "When Screen Field is Completed: " In the CASE FIELD() structure, executed when the field has been completed. <> The "External" template notifies the Application Generator that the procedure is contained in an external source, object, or Library file. No source code is generated for an "External" procedure. The procedure's prototype is placed in the program's MAP from the MODULE Structure Include File named on the Module Properties window. The Module Name field must contain the filename of an external source, object or library file. <> The File template produces a procedure which will allow the user to Pick a DOS filename from a listing of files on the currently logged disk. The user may use the keyboard or the mouse to change directories or select the file. Since the file mask is an Entry field, the file mask may be changed by the user. A mouse double-click on button 1 (The left button on a right handed mouse) will change directory if the directory list box is selected, or will select the highlighted file if in the files list box. Formatter Support The "File" procedure in CLARION.APP is pre-loaded with a screen layout containing 2 listboxes, 1 file mask entry field, 1 directory name display field, and 2 pushbuttons named "OK" and "Cancel". The files listbox shows filenames in the selected directory which match the file mask. The directories listbox displays any subdirectories in the current directory and the parent directory denoted by '..' when available. The file mask entry field is large enough to contain a simple file mask of '*.???' and will cause the files list box to be rebuilt when changed. The directory display field will display the current directory up to 35 characters. The OK pushbutton will write the selected filename to the specified Filename Variable and Cancel pushbutton will return to the calling procedure leaving the Filename Variable with its original contents. Property Fields < Filename Variable:> Filename Variable: The filename may be saved in any string variable. (It is suggested to use STRING(64) since the path will be added. DOS allows a 64 character filename.) However, a default variable has been added to the global data of the Default Application file (GLO:Filespec in CLARION.APP) and it will hold the filename if the Filename Variable is blank. < Initial Directory:> Initial Directory: Optionally, an initial directory may be specified for the opening directory listing (like REPORTS). The File template will call SETPATH() just prior to filling the list box. Another SETPATH() will return to the original path before returning from this procedure. < Beginning file mask:> Beginning file mask: A beginning file mask may also be entered to use for the opening file list. The files will be sorted within the mask. If no match for the file mask is found, the text 'NO MATCH' will appear in the file list box. If no Beginning File Mask is entered the default file mask '*.*' will be used. < Next Procedure:> Next Procedure: Enter the name of a procedure to be called once a filename has been successfully selected. The Filename Variable will be assigned the selected filename and the Next Procedure will be called. The View template was designed in conjunction with the File template and may be used to view the selected file. Enter the name of a procedure created with the View template as the Next Procedure for this combination. < Reselect Upon Return:> Reselect Upon Return: If a Next Procedure is defined, an option is provided to have one of the following occur: 1) Return to the calling procedure after a return from the update procedure. (the default) 2) Allow the user to reselect another filename after a return from the update procedure. (When the checkbox is checked.) < Blank Name On Cancel:> Blank Name On Cancel: If checked, the variable you named as the Filename Variable (above) will be blanked when the user selects the Cancel button. When no Filename Variable is specified, GLO:FileSpec (the default filename variable) is blanked. This option is useful when using a File template without a Next Procedure. In this case, it is possible to detect if the user has not selected a file by checking the value contained in the Filename Variable (or GLO:FileSpec). < Allow Drive Searches:> Allow Drive Searches: If checked, the list of directories will also contain all the current DOS drive letters. This allows the user to search for the file on any valid drive. Embedded Source < Data Section > "Data Section" In the data section of the procedure before local data, the screen and pulldown structures. This may be used to declare any data which you may want to use only in your embedded source code. < Setup Procedure > "Setup Procedure" After the CODE statement. < Setup Screen> "Setup Screen" After the OPEN(Screen) statement. < Top of Accept Loop> "Top of Accept Loop" At the top of the screen field processing loop. < End of Procedure> "End of Procedure" Code placed in this window executes after all other code in the procedure has executed. This code begins in column one, therefore you may use this window to write any ROUTINEs which are called from any other embedded source code window. < When Screen Field is Selected : > "When Screen Field is Selected : " In the CASE SELECTED() structure, executed when the field is selected for entry. < When Screen Field is Completed: > "When Screen Field is Completed: " In the CASE FIELD() structure, executed when the field has been completed. Formula Classes No formula classes are supported by this procedure Template. Formula fields are not supported. <> The "Form" template generates a procedure that will ADD, CHANGE or DELETE a record from the procedure's Primary file (as defined in the File Schematic). If the Global Application prompt, "Enable Shared Files: " is checked ON, the code is generated with complete Record level locking for a multi-user application. Referential Integrity constraints, as defined in the Data Dictionary, are enforced during any update to the Primary file, for ALL 1:MANY relationships to the Primary file. The template allows for multiple auto-increment key fields and concurrency checks of multiple memo fields. "Initial values" defined in the Data Dictionary are pre-loaded during an ADD. "Range checks" are generated from the Data Dictionary definitions and are enforced during an ADD or CHANGE. If an out of range condition exists, the user is notified (using the ShowWarning procedure) of the valid range for the field, and the cursor is placed on that field for editing. The template automatically generates GET statements to access any secondary files where the relationship from the procedures Primary file is defined as MANY:1. Fields from the "1" side of the relationship should be placed on the Screen as "display-only". No code is generated to update files on the "1" side of the relationship. Example: In the Data Dictionary you have defined CUSTOMERS and INVOICES as a 1:MANY relationship; "1" customer may have MANY invoices. That means the INVOICES file is related MANY:1 to the CUSTOMERS file. On the FORM used to update the INVOICES file you can place the CUSTOMERS name and address fields on the Screen, and the correct CUSTOMERS record will be retrieved from the file. But even if you allowed changes to the CUSTOMERS name and address fields, there would not be any code generated to update the CUSTOMERS record. < Must be in File> < Automatic field validation> The "Must be in File" validity check defined in the Data Dictionary is enforced when the field is "completed", or when the user presses the "OK" button. < Lookups> Enter the name of a BROWSE procedure in the "When Field is Selected Procedure:" entry, if you want a Browse "lookup" to appear as soon as the field is selected by the user. Use the "When Field is Completed Procedure:" if you want to "validate" an entry after the user completes the field. < Multiuser File Updates> If the application is set to SHARE files, the procedure enforces multi-user concurrency checking at the record level. If a conflict arises from two or more workstations attempting to update the same record, the Record is re-read from disk and the FORM screen is refreshed. The user is notified of the change, and placed back in edit mode. < Referential Integrity> If Relational Constraints have been defined in the Data Dictionary, code is generated to enforce the Constraint on 1:MANY relationships. All Referential Integrity Constraints are enforced from the Primary file for the procedure, down its Relational File Tree for as many levels as exist. < Transaction Framing > During a relational Change or Delete a HOLD is placed on the Primary file record. All child files of the Primary file are updated within a transaction frame to ensure an 'all or nothing' update or delete. If LOGOUT cannot be initiated, the user is given a chance to retry the update or delete. < No Transaction Framing > Not all file drivers support transaction processing. If you are using a File driver that does not support transaction processing, or using multiple file drivers within a relationship, you will receive a Warning during code generation: "PRIMARY file driver does not support LOGOUT()" If the file driver does not support the LOGOUT statement, code is generated to update the files without the benefit of a transaction frame. Also, if the files in the Relationship use multiple file drivers, the referential update/delete cannot use the LOGOUT statement. For example, if a file relationship is defined with one file using the Btrieve driver and the related file using the Clarion driver, code is generated without a LOGOUT transaction frame. Either situation has the potential to compromise the referential integrity of your database. If the update/delete fails for any reason, your files cannot be restored to their original state. Finally, if you have set up multiple relations between the same two files, transaction framing cannot process these relations. This will be evident at run-time as a Clarion Run-Time error, Cannot Logout Files. In this case, check the Disable RI Logout Check-box on the Procedures Property screen. Formatter Support The default screen contained in CLARION.APP has a local variable named LOC:Message placed at the top of the entry screen. This variable is used to inform the user of the current action: Add, Change, or Delete of the record on the screen. The message displayed is stored in CLARION.APP in the global variables as GLO:InsertMsg, GLO:ChangeMsg, and GLO:DeleteMsg. You can enter your own messages on the Procedure Properties window. If any Prompt for a message is filled in, it will be used instead of the global values stored in the default .APP file. The default screen has two buttons: Ok and Cancel. Both of these fields are required by the template. If a Pulldown structure has been created by the Pulldown Menu Formatter, it is generated after the screen structure. The Pulldown is OPENed after the screen structure, and is closed upon exit from the procedure. The Report Formatter is not supported. Property Fields < Insert Message> Insert Message Enter a message to use instead of the default stored in Clarion.app for Inserting a record. < Change Message> Change Message Enter a message to use instead of the default stored in Clarion.app for Changing a record. < Delete Message> Delete Message Enter a message to use instead of the default stored in Clarion.app for Deleting a record. < Action after ADD> Action after ADD The template supports multiple adds without leaving the FORM screen. There are four possible actions after an ADD: 'Return to caller ' generates code to return to the calling procedure after the record is added. 'Retain Record ' generates code to allow continuous ADDs without clearing the record buffer or the screen. When the user selects the 'Ok' button the record buffer's contents are ADDed to the file and the user is placed back on the first entry field on the screen. If there are Auto-increment keys defined for the file, the record is saved, the next Autonumber is retrieved, then the record is restored. 'Clear Record ' generates code to allow continuous ADDs but clears the record buffer and screen between each ADD. When the user selects the Ok button the screen and record buffer are cleared and the user is placed back on the first entry field on the screen. If there are Auto-increment keys defined for the file, the next Autonumber is retrieved and the screen updated. < Copy field hotkey:> Copy field hotkey: This prompt is dependent on the 'Retain_Record' button. If 'Retain Record' is selected, AND the 'Copy field hotkey' contains a hotkey value, the template generates code for repeated ADDs that allows the user to duplicate individual fields from the prior record only when the hotkey is pressed. When the user presses the Ok button, the screen fields are erased and the cursor is placed back on the first field. If the user presses the defined hotkey the contents of the currently highlighted field are copied from the last record the user added. < Next Procedure> Next Procedure Enter the Procedure to call when the Ok button is pressed, AFTER the file's update has completed without any errors. The Next Procedure call is generated before the code for any Repeated ADDs. < Disable RI Logout> Disable RI Logout If multiple CONSTRAINED relations exist between any two files processed by the Referential Integrity code, when this code is processed your program will experience a Clarion Run-Time halt, Cannot Logout Files. Check the Disable RI Logout Check-Box to stop the RI code from generating. NOTE: ANY RI TRANSACTIONS will not be recoverable if an error occurs. Embedded Source < Data Section > "Data Section" In the data section of the procedure after local data, the screen and pulldown structures. This may be used to declare any data which you may want to use only in your embedded source code. < Setup Procedure > "Setup Procedure" Source code is inserted after the CODE statement. < On Add After Record Buffer Is Cleared > "On Add After Record Buffer Is Cleared" Immediately after the record buffer is cleared for an AddRecord and just before auto-incrementing fields are incremented or fields with initial values are initialized. < Setup Screen > "Setup Screen" After OPEN(Screen). < Before File I/O > "Before File I/O" Immediately before the record is written to disk (ADD, PUT, or DELETE). < Setup Next Procedure > "Setup Next Procedure" If a 'Next Procedure' was defined, code is inserted before the procedure is called. < Return from Next Procedure > "Return from Next Procedure" If a 'Next Procedure' was defined, code is inserted after the procedure is executed. < After ADD on Retain or ClearRecord > "After ADD on Retain or ClearRecord" After a record has been added and just before going on to add another record in "recursive add mode." < End of Procedure > "End of Procedure" Code placed in this window executes after all other code in the procedure has executed. This code begins in column one, therefore you may use this window to write any ROUTINEs which are called from any other embedded source code window. < When Screen Field is Selected : > "When Screen Field is Selected : " In the CASE SELECTED() structure, executed when the field is selected for entry. < When Screen Field is Completed: > "When Screen Field is Completed: " In the CASE FIELD() structure, executed when the field has been completed. Formula Classes < SETUP > SETUP A Conditional or Computed Field with "SETUP" in the Formula Class field is calculated once at the beginning of the procedure before the screen field processing LOOP. < RETURN > RETURN A Conditional or Computed Field with "RETURN" in the Formula Class field is calculated once just before the return from the procedure when the user selects the 'Ok' button. < PRIMEKEY > PRIMEKEY A Conditional or Computed Field with "PRIMEKEY" in the Formula Class field is calculated just before the SET(Key,Key) during an Autoincrement ADD. It is inserted again right before the ADD(File) to preserve any components you have primed. This can be used to prime key components to enable subset numbering. For example, it can be used to cause autonumbering of line item numbers on an invoice. If you have defined a key with the fields InvoiceNumber and LineItemNo, supply the current InvoiceNumber as a PRIMEKEY Formula. The AutoNumber Routine determines the next available LineItemNo for that invoice. The record ADDed to the file will already have InvoiceNumber and LineItemNo in the record buffer and on disk. < No class (blank) > No class (blank) Calculates the formula every time any field on the screen is completed. The calculation code is generated before the field setup routines at the top of the processing LOOP. <> The "Form21" template generates a procedure that will ADD, CHANGE or DELETE a record from the procedure's Primary file (as defined in the File Schematic). This form works similarly to the (non-CUA) version 2.1 form (the same keystrokes are available to navigate and complete the form, as well as version 3.0 button support). Keystrokes supported: CtrlEsc ----------- Cancel CtrlEnter --------- Done Enter ------------- Field complete or Done (on last field) Esc --------------- Field return or Cancel (on first field) The template allows for multiple auto-increment key fields and concurrency checks of multiple memo fields. Referential integrity constraints are enforced for any 1:MANY relationships to the Primary file. Initial field values from the Data Dictionary are pre-loaded during an ADD. Range checking is generated from the Data Dictionary definitions and is enforced during ADD or CHANGE. If an out of range condition exists, the user is notified of the valid range for the field, and the cursor is placed on that field for editing. The template generates GET statements to access secondary files where the relationship is defined as MANY:1. The "Must be in File" automatic field entry validation from the Data Dictionary is enforced when the user presses the OK button. If the value entered in the field does not exist in the specified file, the user is notified and is placed back on the field. Use the "When Field is Completed" Procedure line if you wish to call a Validate procedure. If the application is set to SHARE files, the procedure enforces multi-user concurrency checking at the record level. If a conflict arises from two or more workstations attempting to update the same record, the user's Screen is refreshed with the record as changed by the other workstation, the user is notified of the change, and placed back in edit mode. < Referential Integrity> If Relational Constraints have been defined in the Data Dictionary, code is generated to enforce the Constraint on 1:MANY relationships. All Referential Integrity Constraints are enforced from the Primary file for the procedure, down its Relational File Tree for as many levels as exist. < Transaction Framing > During a relational Change or Delete a HOLD is placed on the Primary file record. All child files of the Primary file are updated within a transaction frame to ensure an 'all or nothing' update or delete. If LOGOUT cannot be initiated, the user is given a chance to retry the update or delete. < No Transaction Framing > Not all file drivers support transaction processing. If the file driver does not support the LOGOUT statement, code is generated to update the files without the benefit of a transaction frame. Also, if the files in the Relationship use multiple file drivers, the referential update/delete cannot use the LOGOUT statement. For example, if a file relationship is defined with one file using the Btrieve driver and the related file using the Clarion driver, code is generated without a LOGOUT transaction frame. Either situation has the potential to compromise the referential integrity of your database. If the update/delete fails for any reason, your files cannot be restored to their original state. Formatter Support The default screen contained in CLARION.APP has a local variable named LOC:Message placed at the top of the entry screen. This variable is used to inform the user of the current action: Add, Change, or Delete of the record on the screen. The message displayed is stored in CLARION.APP in the global variables as GLO:InsertMsg, GLO:ChangeMsg, and GLO:DeleteMsg. You can enter your own messages on the Procedure Properties window. If any Prompt for a message is filled in, it will be used instead of the global values stored in the default .APPfile. The default screen has two buttons: Ok and Cancel. If a Pulldown structure has been created by the Pulldown Menu Formatter, it is generated after the screen structure. The Pulldown is OPENed after the screen structure, and is closed upon exit from the procedure. The Report Formatter is not supported. Property Fields < Insert Message> Insert Message Enter a message to use instead of the default stored in CLARION.APP for Inserting a record. < Change Message> Change Message Enter a message to use instead of the default stored in CLARION.APP for Changing a record. < Delete Message> Delete Message Enter a message to use instead of the default stored in CLARION.APP for Deleting a record. < Action after ADD> Action after ADD The template supports multiple adds without leaving the FORM screen. There are four possible actions after an ADD: "Return to caller " generates code to return to the calling procedure after the record is added. "Retain Record" generates code to allow continuous ADDs without clearing the record buffer or the screen. When the user selects the 'Ok' button the record buffer's contents are ADDed to the file and the user is placed back on the first entry field on the screen. If there are Auto-increment keys defined for the file, the record is saved, the next Autonumber is retrieved, then the record is restored. "Clear Record " generates code to allow continuous ADDs but clears the record buffer and screen between each ADD. When the user selects the Ok button the screen and record buffer are cleared and the user is placed back on the first entry field on the screen. If there are Auto-increment keys defined for the file, the next Autonumber is retrieved and the screen updated. < Copy field hotkey:> Copy field hotkey: This prompt is dependent on the 'Retain_Record' button. If "Retain Record" is selected, AND the "Copy field hotkey" contains a hotkey value, the template generates code for repeated ADDs that allows the user to duplicate individual fields from the prior record only when the hotkey is pressed. When the user presses the Ok button, the screen fields are erased and the cursor is placed back on the first field. If the user presses the defined hotkey the contents of the currently highlighted field are copied from the last record the user added. < Next Procedure> Next Procedure Enter the Procedure to call when the Ok button is pressed (or the form has been "completed"), AFTER the file's update has completed without any errors. The Next Procedure call is generated before the code for any Repeated ADDs. Embedded Source < Data Section > "Data Section" In the data section of the procedure after local data, the screen and pulldown structures. This may be used to declare any data which you may want to use only in your embedded source code. < Setup Procedure > "Setup Procedure" Source code is inserted after the CODE statement. < On Add After Record Buffer Is Cleared > "On Add After Record Buffer Is Cleared" Immediately after the record buffer is cleared for an AddRecord and just before auto-incrementing fields are incremented or fields with initial values are initialized. < Setup Screen > "Setup Screen" After OPEN(Screen). < Before File I/O > "Before File I/O" Immediately before the record is written to disk (ADD, PUT, or DELETE). < Setup Next Procedure > "Setup Next Procedure" If a 'Next Procedure' was defined, code is inserted before the procedure is called. < Return from Next Procedure > "Return from Next Procedure" If a 'Next Procedure' was defined, code is inserted after the procedure is executed. < After ADD on Retain or ClearRecord > "After ADD on Retain or ClearRecord" After a record has been added and just before going on to add another record in "recursive add mode." < End of Procedure > "End of Procedure" Code placed in this window executes after all other code in the procedure has executed. This code begins in column one, therefore you may use this window to write any ROUTINEs which are called from any other embedded source code window. Formula Classes < SETUP > SETUP A Conditional or Computed Field with "SETUP" in the Formula Class field is calculated once at the beginning of the procedure before the screen field processing LOOP. < RETURN > RETURN A Conditional or Computed Field with "RETURN" in the Formula Class field is calculated once just before the return from the procedure when the user selects the 'Ok' button. < PRIMEKEY > PRIMEKEY A Conditional or Computed Field with "PRIMEKEY" in the Formula Class field is calculated just before the SET(Key,Key) during an Autoincrement ADD. It is inserted again right before the ADD(File) to preserve any components you have primed. This can be used to prime key components to enable subset numbering. For example, it can be used to cause autonumbering of line item numbers on an invoice. If you have defined a key with the fields InvoiceNumber and LineItemNo, supply the current InvoiceNumber as a PRIMEKEY Formula. The AutoNumber Routine determines the next available LineItemNo for that invoice. The record ADDed to the file will already have InvoiceNumber and LineItemNo in the record buffer and on disk. < No class (blank) > No class (blank) Calculates the formula every time any field on the screen is completed. The calculation code is generated before the field setup routines at the top of the processing LOOP. <> The "List" template generates a procedure that scrolls data files on the screen like a spreadsheet. Unlike the Browse, Lookup, or Validate templates the List template loads every selected record from the file into memory before displaying the list box. The Queue for the list box must keep track of key values and pointer fields as well as the information displayed in the list box. Therefore, Using the list template for a very large file would fill virtual memory and overflow onto disk. In effect the file is being copied before it is displayed. For this reason, the List template should only be used to display relatively small files or relatively small sections of large files. Selected fields from the data file are displayed as columns in a list box. Columns that do not fit in the list box are displayed using a mouse with the horizontal scroll bar or the left and right arrow keys. A selector bar is always positioned over a single row. The up and down arrow keys move the selector bar. Moving the selector bar up off the top row or down off the bottom row scrolls a new record into the list box. The PGUP and PGDN keys scroll the prior and next pages of records into the list box. CTRL-PGUP displays the first page of records and CTRL-PGDN displays the last page of records. Pressing the right mouse button in the top half of the list box scrolls up and in the bottom half scrolls down. The list box field must be the first field in the screen structure when not using a record filter or record selector. Fields may be placed before or after the list box field in the Field List. Selecting the LIST field from a prior field displays the first page of records. The "Insert", "Change", and "Delete" pushbuttons, or any other field that processes the record under the selector bar must be placed after the LIST field in the Field List. A checkbox is available to view a file in Record order. This is primarily useful in viewing ASCII files. Since ASCII, BASIC, and DOS files have certain limitations, you should know the file system's capabilities before attempting to use the List template with an Update Procedure. (The View template may be used to just View an ASCII file.) If the Checkbox is checked on, any reference to a primary key is ignored by this procedure. Also, a checkbox is available to display the queue in reverse order. When the Record Order checkbox is not checked, the Reverse Order checkbox will display the file in reverse key order. If Both the Record Order checkbox, and the Reverse Order checkbox are on then the file will be displayed in reverse record order. A set of display-only fields can be designated as "hot fields" on screen. Hot fields display values from the record currently highlighted by the selector bar and change whenever the selector bar moves. This allows display of more information from the highlighted record than just the one line in the List box. These hot fields MUST appear consecutively in the Field List but may be placed anywhere on screen. Formatter Support The "List" procedure in CLARION.APP is pre-loaded with a screen layout containing a list box and pushbuttons named "Insert", "Change", "Delete", and "Exit". The field equate label of the list box must be "?List". The horizontal scroll bar can be turned off if the required information fits in the list box. The vertical scroll bar is also optional. All other properties of the list box can be changed. Fields from related files may be scrolled in the list box as "lookups" will be done automatically from the Primary file in the file schematic to Secondary files with a "Many to 1" relationship. The "Insert", "Change", and "Delete" pushbuttons call an update procedure to process the selected record. (The update procedure is now normally created with a "Form" template.) The name of the procedure must be entered as the "Update Procedure". If there is no update procedure, these pushbuttons can be deleted. If all three pushbuttons are deleted, yet an update procedure exists, the Insert, Enter and Delete keys will Insert, Change and Delete while the list box is selected. However, If only one or two of these buttons have been removed the function of that button (Insert, Change, or Delete) will be removed from the list box as well and no update procedure will be called. The "Exit" pushbutton should not be deleted. Local data is generated before the screen structure. If a pulldown structure has been created by the Pulldown Menu Formatter, it is generated after the screen structure. The template makes no provision for opening or closing a pulldown menu. Such statements must be entered as embedded source. The Report Formatter is not supported. Property Fields < Range Limit Field:> Range Limit Field: The range of records to be displayed can be limited by fixing the value of a component of the primary file access key. For example, line items on an invoice can be limited to a single invoice. The key for the item file might contain ITM:Invoice and ITM:Line containing the invoice number and line number of the item. ITM:Invoice would be the Range Limit Field, displaying only those records for a fixed invoice number. < Range Value Field:> Range Value Field: The Range Value Field is the field which holds the value to be used as the limiting key component value. The key component will be assigned this value. In this example, the current Invoice record might contain the number of the invoice that is being displayed. INV:Number would be the Range Value Field, supplying the value for the Range Limit Field. The Range Value Field must not be the same field as the Range Limit Field. < Record Filter:> Record Filter: There are 2 ways to enter a record filter: The formula generator can be used with a formula class of 'FILTER' to validate the expression as entered. Enter a free-form record filter expression in this field. No validation is done on the code you enter -- an invalid expression will generate compiler errors. If you are not familiar with the Clarion language statements or expressions, do not use this entry -- use a Formula field with the FILTER Formula Class instead. < Update Procedure:> Update Procedure: Enter the name of the update procedure to be used to insert, change, or delete records. If no update procedure is entered, the "Insert", "Change", and "Delete" pushbuttons should be removed from the screen layout. Special considerations may exist when using ASCII, DOS, and BASIC file drivers. In some cases a PUT or DELETE is not allowed. See the file driver's documentation for file driver specifics. < First Hot Field:> First Hot Field: Hot fields are a set of display-only fields that display the contents of the record under the selector bar. They must appear consecutively in the Field List. Enter the name of the first hot field. < Last Hot Field:> Last Hot Field: Enter the name of the last hot field. < Enable Hot Records > [û] Enable Hot Records By enabling hot records the programmer has complete control at every list box movement from the Browse manager. With this option enabled, every movement of the point bar gets the record under the point bar into memory, looks up any many to one secondary files, computes any general formulas and executes any embedded source code which was entered in the 'Process Selected Record' code window. < Queue Rebuild> [û] Queue Rebuild This checkbox causes the QUEUE to be rebuilt after each call to the update procedure. This is suggested when using shared files, or when calling a form with multiple add capability. < Record Order > [û] Record Order Checking this box causes the template to ignore any key file access information. The following must be considered: - The Access Key in the File Schematic will be ignored. - Range Limits will not be used. This option was created to allow the view of ASCII, DOS, and BASIC files. < Reverse Order> [û] Reverse Order This checkbox will reverse the order in which the Queue will be built. This allows a reverse key file listing of records in file systems which do not support descending keys. < Progress Indicator> [û] Progress Indicator Checking the Progress Indicator Checkbox will display a moving bar across the screen as records are loaded into the QUEUE. The bar is displayed in the Local Data variable named StatusLine which has been pre loaded into the Default Application file. This line has also been placed on the default screen for the List template and must be in the screen list after the list box. < Progress Character:> Progress Character: You may enter the ASCII character to be used as the 'bar.' Easy entry of high order ascii characters may be made by using the ASCII value found in the ASCII chart from the Tools menu. The ASCII value should be surrounded by angle brackets within single quotes. The Default Application file is preloaded with a shaded bar character '<176>'. Embedded Source < Data Section> "Data Section" In the data section of the procedure after local data, the screen and pulldown structures. This may be used to declare any data which you may want to use only in your embedded source code. < Setup Procedure> "Setup Procedure" After the CODE statement. < Setup Screen> "Setup Screen" After OPEN(Screen) statement. < Setup Pulldown> "Setup Pulldown" After OPEN(PullDown) statement. < LIST Class Formula> "LIST Class Formula" After generation of LIST class formulas. This embedded code window may be used instead of LIST class formulas. This will allow setting up any fields which are displayed within the scrolling listbox. < End of General Formulas> "End of General Formulas" When processing a screen field, the formulas which do not have a class of 'FILTER' of 'LIST' will be generated. This embedded source window allows the entry of computations for screen display fields without the use of the formula formatter. < Process Selected Record> "Process Selected Record" NOTE: THIS EMBED IS ONLY GENERATED IF YOU HAVE HOT RECORDS ENABLED. Code entered in this EMBED will be placed in the FIELD() processing of ?LIST, directly before the handling of KEYCODE(). < End of Procedure> "End of Procedure" Code placed in this window executes after all other code in the procedure has executed. This code begins in column one, therefore you may use this window to write any ROUTINEs which are called from any other embedded source code window. < When Screen Field is Selected : > "When Screen Field is Selected : " In the CASE SELECTED() structure, executed when the field is selected for entry. < When Screen Field is Completed: > "When Screen Field is Completed: " In the CASE FIELD() structure, executed when the field has been completed. Formula Classes < FILTER> FILTER A conditional formula of class "FILTER" created by the Formula Formatter is used to select which records are displayed. If the conditional formula evaluates to zero (false) for a given record, it is not displayed. < LIST > LIST A Conditional or Computed Field with "LIST" in the Formula Class field is used for those values which will be displayed in the list box and are only evaluated when the list box item is created. < No class (blank)> No class (blank) Calculates the formula every time any field on the screen is completed. The calculation code is generated before the field setup routines at the top of the processing LOOP. <> The "Lookup" template generates a procedure that will be used to preform entry field verification. The procedure MUST be called as a When Field is Selected Procedure on the entry field to validate. When the entry field has been selected, the Lookup procedure will be called to check for the existence of the value in the current field against the specified key. If no match is found a screen with a list box is presented to allow the user to select a valid entry. Selected fields from the data file are displayed as columns in a list box. Columns that do not fit in the list box are displayed using the horizontal scroll bar or the left and right arrow keys. A selector bar is always positioned over a single row. The up and down arrow keys move the selector bar. Moving the selector bar up off the top row or down off the bottom row scrolls a new record into the list box. The PGUP and PGDN keys scroll the prior and next pages of records into the list box. CTRL-PGUP displays the first page of records and CTRL-PGDN displays the last page of records. Pressing the right mouse button in the top half of the list box scrolls up and in the bottom half scrolls down. The ENTER key and the mouse double-click selects the highlighted record and completes the procedure. The Lookup Template uses PRESS to place the selected value into the entry field it was called to validate. Therefore, if numeric data is being validated, the typing mode of that field should be INSERT. This allows PRESS to put the correct value into the field. The "Select", "Insert" and "Change" pushbuttons, or any other field that processes the record under the selector bar must be placed after the LIST field in the Field List. An optional locator field finds a specific record in the file. Typing any letter while the LIST field is active selects the locator field. Completing the locator field with a TAB key or mouse CLICK displays the closest matching record at the top of the list box. Another option is an "incremental locator", which allows a half-second pause for user entry into a locator field, and then automatically finds the closest matching record to the contents in the locator field. The backspace key is active during this process. For numeric data types, it is recommended to use a string picture type (for display purposes). Date fields are not recommended for incremental locators. A set of display-only fields can be designated as "hot fields" on screen. Hot fields display values from the record currently highlighted by the selector bar and change whenever the selector bar moves. This allows display of more information from the highlighted record than just the one line in the List box. These hot fields MUST appear consecutively in the Field List but may be placed anywhere on screen. When you define a SUM or AVG formula class, total field code generation is automatically enabled. Formatter Support The "Lookup" procedure in CLARION.APP is pre-loaded with a screen layout containing a list box and pushbuttons named "Select", "Insert", "Change" and "Exit". The field equate label of the list box MUST be "?List" and the "Immediate" attribute MUST be on turned on. The horizontal scroll bar can be turned off if the required information fits in the list box. All other properties of the list box can be changed. Fields from related files may be scrolled in the list box as "lookups" will be done automatically from the Primary file in the file schematic to Secondary files with a "Many to 1" relationship. "1 to Many" relationships are not supported by this procedure Template. The "Insert" and "Change" pushbuttons call an update procedure to process the selected record (normally created with a "Form" template). The name of the procedure must be entered as the "Update Procedure". If there is no update procedure, these pushbuttons may be deleted. The ENTER key and mouse DOUBLE- CLICK while on the listbox will select the record under the selector bar and enter the value in the entry field. The "Exit" pushbutton should not be deleted. Local data is generated before the screen structure. If a pulldown structure has been created by the Pulldown Menu Formatter, it is generated after the screen structure. The template makes no provision for opening or closing a pulldown menu (you must write embedded source for this). Property Fields < Range Limit Field: > Range Limit Field: The range of records to be displayed can be limited by fixing the value of a component of the primary file access key. For example, line items on an invoice can be limited to a single invoice. The key for the item file might contain ITM:Invoice and ITM:Line containing the invoice number and line number of the item. ITM:Invoice would be the Range Limit Field, displaying only those records for a fixed invoice number. < Range Value Field: > Range Value Field: The Range Value Field is the field which holds the value to be used as the limiting key component value. The key component will be assigned this value. In this example, the current Invoice record might contain the number of the invoice that is being displayed. INV:Number would be the Range Value Field, supplying the value for the Range Limit Field. The Range Value Field must not be the same field as the Range Limit Field. < Record Filter:> Record Filter: There are 2 ways to enter a record filter: The formula generator can be used with a formula class of 'FILTER' to validate the expression as entered. Enter a free-form record filter expression in this field. No validation is done on the code you enter -- an invalid expression will generate compiler errors. If you are not familiar with the Clarion language statements or expressions, do not use this entry -- use a Formula field with the FILTER Formula Class instead. < Lookup Field: > Lookup Field: Enter the name of the field to be used to validate against your entry field. This field should be the only field in a single-component unique key. < Input Field Picture: > Input Field Picture: Some fields do not appear on screen in the same format as the data exists in the file (and in the key). These fields must have an Input Field Picture to DEFORMAT the data for validation and to FORMAT the selected data for on-screen display. Enter the display picture to DEFORMAT the data for validation. This picture is also used to FORMAT the data to PRESS it into the keyboard buffer and fill the entry field when a record is selected from this procedure's list. Examples of fields which require an Input Field Picture: Any STRING, CSTRING, or PSTRING with an implied decimal storage picture (for example, @N6v2). Any numeric data field (LONG, DATE, USHORT, etc.) with a date (@D1, @D2, etc.) or time (@T1, @T2, etc.) display picture. Any numeric data field (REAL, BFLOAT, etc.) with a display picture which includes a decimal portion (for example, @N6.2). < Locator Field: > Locator Field: A locator field is a screen entry field that updates a component of the primary file access key. When a locator field is entered, the closest matching record is displayed in the list box. For example, scrolling a vendor file in vendor name sequence uses a key that contains the vendor name field (e.g. VND:Name). To create a vendor name locator field, place a VND:Name entry field on the screen below the list box and enter VND:Name for the Locator Field. Once the user types a character on the keyboard, the locator field is selected and allows entry for the match. Pressing the Tab key positions the point bar to the closest match. Another option is "Incremental Locator". This template option allows one-half second for the user to type a new letter into the locator field. At each pause longer than one-half second, the field contents are used to locate the closest match (the Tab key does not need to be pressed). The backspace key is active during this process. < Incremental Locator > [û] Incremental Locator Check this box to indicate that the Locator Field will act as an incremental locator. < Display Key: > Display Key: If using one key for entry field validation and another key as the display key, enter the name of the display key here. Otherwise, leave this field blank. < Update Procedure: > Update Procedure: Enter the name of the update procedure to be used to insert, change, or delete records. If no update procedure is entered, the "Insert", "Change", and "Delete" pushbuttons should be removed from the screen layout. < First Hot Field: > First Hot Field: Hot fields are a set of display-only fields that display the contents of the record under the selector bar. They must appear consecutively in the Field List. Enter the name of the first hot field. < Last Hot Field: > Last Hot Field: Enter the name of the last hot field. < Enable Hot Records > [û] Enable Hot Records By enabling hot records the programmer has complete control at every list box movement from the Browse manager. With this option enabled, every movement of the point bar gets the record under the point bar into memory, looks up any many to one secondary files, computes any general formulas and executes any embedded source code which was entered in the 'Process Selected Record' code window. Embedded Source < Data Section > "Data Section" In the data section of the procedure after local data, the screen and pulldown structures. This may be used to declare any data which you may want to use only in your embedded source code. < Setup Procedure > "Setup Procedure" After the CODE statement. < Setup Screen > "Setup Screen" After OPEN(Screen). < Setup Pulldown> "Setup Pulldown" After OPEN(PullDown) statement. < Set to First Record Before Total Loop> "Set to First Record Before Total Loop" After the SET(key,key) for Range limits before beginning the total calculation LOOP. < Inside Total Loop, Immediately after NEXT> "Inside Total Loop, Immediately after NEXT" Immediately after each record is read in the total calculation LOOP. < Inside Total Loop after Filter> "Inside Total Loop after Filter" After each record is read and filter conditions are evaluated in the total calculation LOOP. < After Total Field Loop> "After Total Field Loop" After all totals have been calculated. < LIST Class Formula> "LIST Class Formula" After generation of LIST class formulas. This embedded code window may be used instead of LIST class formulas. This will allow setting up any fields which are displayed within the scrolling listbox. < End of General Formulas> "End of General Formulas" When processing a screen field, the formulas which do not have a class of 'FILTER' of 'LIST' will be generated. This embedded source window allows the entry of computations for screen display fields without the use of the formula formatter. < Case of No Records Found> "Case of No Records Found" When no records are found to display. < After Filter and Range Check> "After Filter and Range Check" After any record filter or Range limits are evaluated. < Set to First Record> "Set to First Record" When using Range Limits, a SET statement is issued to locate the first record. This embedded source code window appears just after the SET statement and allows you to override the SET. < Set to Last Record> "Set to Last Record" When using Range Limits, a SET statement is used to locate the closest match to the last record. This embedded source code window appears just after the SET statement and allows you to override the SET. < Process Selected Record> "Process Selected Record" When Enable Hot Records has been checked, code within this embedded source window will be executed upon movement of the point bar. The record under the point bar will be retrieved into memory, any many to one secondary file records will be retrieved and any general formulas will be computed just prior to the insertion of this embedded source code. < End of Procedure> "End of Procedure" Code placed in this window executes after all other code in the procedure has executed. This code begins in column one, therefore you may use this window to write any ROUTINEs which are called from any other embedded source code window. < Prior to Update Procedure> "Prior to Update Procedure" Immediately before the Update Procedure is called. < After Update Procedure> "After Update Procedure" Immediately after return from the Update Procedure. < When Screen Field is Selected : > "When Screen Field is Selected : " In the CASE SELECTED() structure, executed when the field is selected for entry. < When Screen Field is Completed: > "When Screen Field is Completed: " In the CASE FIELD() structure, executed when the field has been completed. Formula Classes < LIST > LIST A Conditional or Computed Field with "LIST" in the Formula Class field is used for those values which will be displayed in the list box and are only evaluated when the list box item is created. < SUM > SUM A Computed Field with "SUM" in the Formula Class field calculates the total of the values contained in the field named in the Expression. A Conditional Field with "SUM" in the Formula Class field conditionally calculates the total of the values contained in the fields named in the True and False Expressions. < AVG > AVG A Computed Field with "AVG" in the Formula Class field calculates the arithmetic mean of the field named in the Expression. A Conditional Field with "AVG" in the Formula Class field conditionally calculates the arithmetic mean of the fields named in the True and False Expressions. In both cases, the total value is calculated, then divided by the number of records read to achieve that total. < No class (blank) > No class (blank) Calculates the formula every time any field on the screen is completed. The calculation code is generated before the field setup routines at the top of the processing LOOP. <> The "MemForm21" template generates a procedure that processes a screen created with the Screen Formatter. The "MemForm21" template is similar to a verion 2.1 "Form procedure using the MEMORY file". Therefore, it does not automatically write any record to disk. It supports the (non-CUA) version 2.1 keystrokes: CtrlEsc ----------- Cancel CtrlEnter --------- Done Enter ------------- Field complete or Done (on last field) Esc --------------- Field return or Cancel (on first field) Formatter Support The "MemForm21" procedure in CLARION.APP is pre-loaded with an empty screen layout. Local data is generated before the screen structure. If a pulldown structure has been created by the Pulldown Menu Formatter, it is generated after the screen structure. The template makes no provision for opening or closing a pulldown menu, or any files. Such statements must be entered as embedded source. Statements from the Formula Formatter are generated at the top of the keyboard loop before the field setup routines. The Report Formatter is not supported. Property Fields < Next Procedure> Next Procedure Enter the Procedure to call when the Ok button is pressed (or the screen has been "completed"). Embedded Source < Data Section > "Data Section" In the data section of the procedure, after local data and the report structure. This may be used to declare any data which you may want to use only in your embedded source code. < Setup Procedure > "Setup Procedure" After the CODE statement. < Setup Screen > "Setup Screen" After OPEN(Screen). < When Screen Field is Selected : > "When Screen Field is Selected : " In the CASE SELECTED() structure, executed when the field is selected for entry. < When Screen Field is Completed: > "When Screen Field is Completed: " In the CASE FIELD() structure, executed when the field has been completed. Formula Classes < SETUP > SETUP A Conditional or Computed Field with "SETUP" in the Formula Class field is calculated once at the beginning of the procedure before the screen field processing LOOP. < RETURN > RETURN A Conditional or Computed Field with "RETURN" in the Formula Class field is calculated once just before the return from the procedure when the user selects the 'Ok' button. < PRIMEKEY > PRIMEKEY A Conditional or Computed Field with "PRIMEKEY" in the Formula Class field is calculated just before the SET(Key,Key) during an Autoincrement ADD. It is inserted again right before the ADD(File) to preserve any components you have primed. This can be used to prime key components to enable subset numbering. For example, it can be used to cause autonumbering of line item numbers on an invoice. If you have defined a key with the fields InvoiceNumber and LineItemNo, supply the current InvoiceNumber as a PRIMEKEY Formula. The AutoNumber Routine determines the next available LineItemNo for that invoice. The record ADDed to the file will already have InvoiceNumber and LineItemNo in the record buffer and on disk. < No class (blank) > No class (blank) Calculates the formula every time any field on the screen is completed. The calculation code is generated before the field setup routines at the top of the processing LOOP. <> The "Menu" template generates a procedure that displays a pop-up menu used to execute other procedures. Menu items are placed on screen as BUTTON in the Screen Formatter. The procedure associated with each button must be its When Button is Pressed Procedure. At least one button field should have a "RETURN" procedure call to exit the "Menu" procedure. Other fields can be placed on the screen. However, this template makes no provision for accessing or updating data files. Formatter Support The "Menu" procedure in CLARION.APP is preloaded with a screen layout containing a pushbutton named "Exit". The "Exit" pushbutton calls the "RETURN" procedure. The "Exit" pushbutton can be renamed, but if it is deleted, some other provision must be made to return from the procedure. Local data is generated before the screen structure. If a pulldown menu has been created by the Pulldown Menu Formatter, it is generated after the screen structure. However, the "Menu" template makes no provision for opening or closing a pulldown menu. Such statements must be entered as embedded source. The Report Formatter is not supported. Embedded Source < Data Section > "Data Section" In the data section of the procedure after local data, the screen and pulldown structures. This may be used to declare any data which you may want to use only in your embedded source code. < Setup Procedure > "Setup Procedure" After the CODE statement. < Setup Screen > "Setup Screen" After OPEN(Screen). < Top of Accept Loop> "Top of Accept Loop" Immediately after the LOOP statement which processes each screen field. < End of Procedure> "End of Procedure" Code placed in this window executes after all other code in the procedure has executed. This code begins in column one, therefore you may use this window to write any ROUTINEs which are called from any other embedded source code window. < When Screen Field is Selected : > "When Screen Field is Selected : " In the CASE SELECTED() structure, executed when the field is selected for entry. < When Screen Field is Completed: > "When Screen Field is Completed: " In the CASE FIELD() structure, executed when the field has been completed. Formula Classes No formula classes are supported by this procedure Template. All statements from the Formula Formatter are generated at the top of the keyboard loop before the field setup routines. <> The "Menu21" template generates a procedure that displays a pop-up menu used to execute other procedures. This is provided for conversion of version 2.1 Menu Procedures. The difference between the "Menu" and "Menu21" procedure Templates are their handling of the Esc and CtrlEsc keys. Menu items are placed on screen as BUTTON fields in the Screen Formatter. The procedure associated with each button must be its When Button is Pressed Procedure. Other fields can be placed on the screen. However, this template makes no provision for accessing or updating data files. Formatter Support The "Menu21" procedure in CLARION.APP is preloaded with a screen layout containing a pushbutton named "Exit". The "Exit" pushbutton calls the "RETURN" procedure. The "Exit" pushbutton can be renamed. Local data is generated before the screen structure. If a pulldown menu has been created by the Pulldown Menu Formatter, it is generated after the screen structure. However, the "Menu" template makes no provision for opening or closing a pulldown menu. Such statements must be entered as embedded source. The Report Formatter is not supported. Embedded Source < Data Section > "Data Section" In the data section of the procedure after local data, the screen and pulldown structures. This may be used to declare any data which you may want to use only in your embedded source code. < Setup Procedure > "Setup Procedure" After the CODE statement. < Setup Screen > "Setup Screen" After OPEN(Screen). < Computed Fields> "Computed Fields" Immediately after the any Formulas are calculated. < End of Procedure> "End of Procedure" Code placed in this window executes after all other code in the procedure has executed. This code begins in column one, therefore you may use this window to write any ROUTINEs which are called from any other embedded source code window. < When Screen Field is Selected : > "When Screen Field is Selected : " In the CASE SELECTED() structure, executed when the field is selected for entry. < When Screen Field is Completed: > "When Screen Field is Completed: " In the CASE FIELD() structure, executed when the field has been completed. Formula Classes < RETURN > RETURN A Conditional or Computed Field with "RETURN" in the Formula Class field is calculated just before the return from the procedure when the user exits the procedure. < Blank (no class)> Blank (no class) All formulas are generated at the top of the keyboard loop before the field setup routines. <> The "MultiPage" template is designed to work in conjunction with the "PageOf" procedure template. The "MultiPage" template generates a procedure that will ADD, CHANGE or DELETE a record from the procedures Primary data file. The template allows for multiple auto-increment key fields and concurrency checks of multiple memo fields. Relational integrity constraints are enforced from the Primary file down its relational tree, for all 1:MANY relationships. The MultiPage and the PageOf templates are designed to work together. All file I/O is done by the MultiPage procedure. Access to the PageOf procedures is handled thru MultiPage. The PageOf procedures are expected to use the same data file as the MultiPage procedure. MultiPage passes each PageOf procedure the (4) following parameters: the current Action (Add / Change / Delete / Check_Required), the current Page number, the total number of Pages, and the Message describing the current update. ÚÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ MultiPage ³ ( First page of a multi-page data entry form ) ÀÄÄÂÄÄÄÄÄÄÄÄÄÄÙ ³ Any 'PageOf' can be accessed directly from ³ MultiPage by pressing the Alt key and the ³ corresponding page number. Pressing the ³ PageDown key from any page access the next ³ available page. Pressing PageDown on the Last ³ Page wraps around to the main (MultiPage) page. ³ ÃÄÄÄÄPageOf (the page 2 procedure) ÃÄÄÄÄPageOf (the page 3 procedure) ÃÄÄÄÄPageOf (the page 4 procedure) ÃÄÄÄÄPageOf (the page 5 procedure) ÃÄÄÄÄPageOf (the page 6 procedure) ÃÄÄÄÄPageOf (the page 7 procedure) ÃÄÄÄÄPageOf (the page 8 procedure) ÀÄÄÄÄPageOf (the page 9 procedure) The template supports up to eight (8) additional pages. The PageOf procedure calls are all entered on the MultiPage template's Procedure Properties window. Procedures named in the Page prompts must use the "PageOf" procedure template. At runtime the generated procedure tracks which "PageOf" procedures have been called. When the user presses 'Ok' any "PageOf" procedure which has not yet been accessed by the user, will be called in order to check for 'Required' fields. The PageOf procedure is called and immediately placed in nonstop edit mode. If a required field has been left blank, the user is notified and placed in edit mode. Initial field values from the data dictionary are pre-loaded during an ADD. Range checking is generated from the data dictionary definitions and is enforced during ADD or CHANGE. If an out of range condition exists the user is notified of the valid range for the field, and the cursor is placed on that field for editing. The template generates lookups for accessing secondary files where the relationship is defined as MANY:1. The "Must be in File" automatic field validation is enforced when the user selects OK. If the value entered does not exist in the specified file the user is notified and is placed back on the field. If the application is set to SHARE files, the procedure enforces multi-user concurrency checking at the record level. If a conflict arises from two or more workstations attempting to update the same record, the user's Screen is refreshed with the record as changed by the other workstation, the user is notified of the change, and placed back in edit mode. < Referential Integrity> If Relational Constraints have been defined in the Data Dictionary, code is generated to enforce the Constraint on 1:MANY relationships. All Referential Integrity Constraints are enforced from the Primary file for the procedure, down its Relational File Tree for as many levels as exist. < Transaction Framing > During a relational Change or Delete a HOLD is placed on the Primary file record. All child files of the Primary file are updated within a transaction frame to ensure an 'all or nothing' update or delete. If LOGOUT cannot be initiated, the user is given a chance to retry the update or delete. < No Transaction Framing > Not all file drivers support transaction processing. If the file driver does not support the LOGOUT statement, code is generated to update the files without the benefit of a transaction frame. Also, if the files in the Relationship use multiple file drivers, the referential update/delete cannot use the LOGOUT statement. For example, if a file relationship is defined with one file using the Btrieve driver and the related file using the Clarion driver, code is generated without a LOGOUT transaction frame. Either situation has the potential to compromise the referential integrity of your database. If the update/delete fails for any reason, your files cannot be restored to their original state. Finally, if you have set up multiple relations between the same two files, transaction framing cannot process these relations. This will be evident at run-time as a Clarion Run-Time error, Cannot Logout Files. In this case, check the Disable RI Logout Check-box on the Procedures Property screen. Formatter Support The default screen contained in CLARION.APP has a local variable named LOC:Message placed at the top of the entry screen. This variable is used to inform the user of the current action: Add, Change, or Delete of the record on the screen. The message displayed is stored in CLARION.APP in the global variables GLO:InsertMsg, GLO:ChangeMsg, and GLO:DeleteMsg respectively. The programmer can enter his own messages on the Procedure Properties window. If any Prompt for a message is filled in, it will be used instead of the global values stored in the default .APP file. The default screen also has two local variables for page number display; LOC:Page and LOC:Pages. These variables are used to display the current page (LOC:Page), and the total number of pages (LOC:Pages). The template places an ALRT attribute for the Alt-# key for each procedure named in the Page prompts. Each page procedure cam be called by pressing Alt and the "Page's Procedure number" key. For example, Alt2 calls the Page2 procedure, Alt3 the Page3 procedure, and so on. The default screen has three buttons; Ok, Cancel and Next_Page. All three fields are required by the template. Property Fields < Insert Message> Insert Message Enter a message to use instead of the default stored in Clarion.app for Inserting a record. < Change Message> Change Message Enter a message to use instead of the default stored in Clarion.app for Changing a record. < Delete Message> Delete Message Enter a message to use instead of the default stored in Clarion.app for Deleting a record. < # Page Procedure> # Page Procedure There are eight (8) Prompts for additional pages. They are called in their numerical order, for instance the '2nd Page Procedure' is called when the user presses either the Next_Page button, the Page Down key, or the Alt2 key. Name your additional Page procedure calls in these prompts. These must be filled in consecutively -- you must not leave any "holes" in the list of "PageOf" procedure calls. < Next Procedure> Next Procedure Enter the Procedure to call when the Ok button is pressed, AFTER the file's update has completed without any errors. The Next Procedure call is generated before the code for any Repeated ADDs. < Disable RI Logout> Disable RI Logout If multiple CONSTRAINED relations exist between any two files processed by the Referential Integrity code, when this code is processed your program will experience a Clarion Run-Time halt, Cannot Logout Files. Check the Disable RI Logout Check-Box to stop the RI code from generating. NOTE: ANY RI TRANSACTIONS will not be recoverable if an error occurs. Embedded Source < Data Section > "Data Section" In the data section of the procedure after local data, the screen and pulldown structures. This may be used to declare any data which you may want to use only in your embedded source code. < Setup Procedure > "Setup Procedure" Source code is inserted after the CODE statement. < Setup Screen > "Setup Screen" After OPEN(Screen). < Setup Next Procedure > "Setup Next Procedure" If a 'Next Procedure' was defined, code is inserted before the procedure is called. < Return from Next Procedure > "Return from Next Procedure" If a 'Next Procedure' was defined, code is inserted after the procedure is executed. < Ok Button Press > "Ok Button Press" Code is inserted to execute as soon as the "Ok" button is pressed, before going into non-stop mode. < Next Page Button Press > "Next Page Button Press" Code is inserted to execute as soon as the "Next_Page" button is pressed, before going accessing the next page. < End of Procedure > "End of Procedure" Code placed in this window executes after all other code in the procedure has executed. This code begins in column one, therefore you may use this window to write any ROUTINEs which are called from any other embedded source code window. < When Screen Field is Selected : > "When Screen Field is Selected : " In the CASE SELECTED() structure, executed when the field is selected for entry. < When Screen Field is Completed: > "When Screen Field is Completed: " In the CASE FIELD() structure, executed when the field has been completed. Formula Classes < SETUP > SETUP A Conditional or Computed Field with "SETUP" in the Formula Class field is calculated once at the beginning of the procedure before the screen field processing LOOP. < RETURN > RETURN A Conditional or Computed Field with "RETURN" in the Formula Class field is calculated once just before the return from the procedure when the user selects the 'Ok' button. < PRIMEKEY > PRIMEKEY A Conditional or Computed Field with "PRIMEKEY" in the Formula Class field is calculated just before the SET(Key,Key) during an Autoincrement ADD. It is inserted again right before the ADD(File) to preserve any components you have primed. This can be used to prime key components to enable subset numbering. For example, it can be used to cause autonumbering of line item numbers on an invoice. If you have defined a key with the fields InvoiceNumber and LineItemNo, supply the current InvoiceNumber as a PRIMEKEY Formula. The AutoNumber Routine determines the next available LineItemNo for that invoice. The record ADDed to the file will already have InvoiceNumber and LineItemNo in the record buffer and on disk. < No class (blank) > No class (blank) Calculates the formula every time any field on the screen is completed. The calculation code is generated before the field setup routines at the top of the processing LOOP. <> The "PageOf" procedure template is designed to work together with the MultiPage template. PageOf is subordinate to MultiPage. The PageOf procedure has no facility to update a record on disk. All file updates are handled by the MultiPage template procedure. A PageOf procedure's prototype in the MAP looks like: ProcName(BYTE,*BYTE,BYTE,STRING) The parameters passed from the MultiPage procedure are: (Action,Page,Pages,Message) The PageOf procedures are expected to use the same data file as the MultiPage procedure. MultiPage passes each PageOf procedure the (4) following parameters: the current Action (Add / Change / Delete / Check_Required), the current Page number, the total number of Pages, and the Message describing the current update. At runtime the MultiPage procedure tracks which "PageOf" procedures have been called. When the user presses 'Ok' any "PageOf" procedure which has not yet been accessed by the user will be called in order to check for 'Required' fields. The PageOf procedure is called and immediately placed in nonstop edit mode. If a required field has been left blank, the user is notified and placed in edit mode. Initial field values from the data dictionary are pre-loaded during an ADD. Range checking is generated from the data dictionary definitions and is enforced during ADD or CHANGE. If an out of range condition exists the user is notified of the valid range for the field, and the cursor is placed on that field for editing. The template will generate lookups for accessing secondary files where the relationship is defined as MANY:1. The "Must be in File" automatic field validation is enforced when the user selects 'OK'. If the value entered does not exist in the specified file the user is notified and is placed back on the field. If the application is set to SHARE files the MultiPage procedure enforces multi-user concurrency checking at the record level. If Relational Constraints have been defined in the Data Dictionary, the code generated from the MultiPage template enforces those constraints. Formatter Support The default screen contained in CLARION.APP has a local variable named LOC:Message placed at the top of the entry screen. This variable is used to inform the user of the current action: Add, Change, or Delete of the record on the screen. The message displayed is stored in CLARION.APP in the global variables GLO:InsertMsg, GLO:ChangeMsg, and GLO:DeleteMsg respectively. The programmer can enter his own messages on the Procedure Properties window. If any Prompt for a message is filled in, it will be used instead of the global values stored in the default .APP file. The default screen also has two local variables for page number display; LOC:Page and LOC:Pages. These variables are used to display the current page (LOC:Page), and the total number of pages (LOC:Pages). The PageUp and PageDown keys will access the next or prior page procedures. The CtrlPgUp and CtrlPgDn keys will call the first or last page procedures respectively. The default screen has four buttons; Base_Page, Previous_Page, Next_Page, and Last_Page. The Next_Page and Previous_Page button fields are required by the template, Base_Page and Last_Page are optional. Pressing the Base_Page button will return the user to the main page (MultiPage template). The Previous and Next Page buttons call the next or previous page procedures. The Last_Page button calls the last page procedure defined on the MultiPage procedure property screen. If a Pulldown structure has been created by the Pulldown Menu Formatter, it is generated after the screen structure. The Pulldown is OPENed after the screen structure, and is closed upon exit from the procedure. The Report Formatter is not supported. Property Fields The "PageOf" Procedure Properties window has no specialized prompts. Embedded Source < Data Section > "Data Section" In the data section of the procedure after local data, the screen and pulldown structures. This may be used to declare any data which you may want to use only in your embedded source code. < Setup Procedure > "Setup Procedure" Source code is inserted after the CODE statement. < Setup Screen > "Setup Screen" < Base_Page Button Press > "Base_Page Button Press" Code is inserted to execute as soon as the "Base Page" button is pressed, before going into non-stop mode and returning to the main (MultiPage) procedure. < Previous_Page Button Press > "Previous_Page Button Press" Code is inserted to execute as soon as the "Previous Page" button is pressed, before going into non-stop mode and returning to the prior page procedure. < Next_Page Button Press > "Next_Page Button Press" Code is inserted to execute as soon as the "Next_Page" button is pressed, before going into non-stop mode and returning to the next page procedure. If Next_Page is pressed on the last page, the user is placed on the first page (MultiPage) procedure. < Last_Page Button Press > "Last_Page Button Press" Code is inserted to execute as soon as the "Last Page" button is pressed, before going into non-stop mode and calling the last page procedure. < End of Procedure > "End of Procedure" Code placed in this window executes after all other code in the procedure has executed. This code begins in column one, therefore you may use this window to write any ROUTINEs which are called from any other embedded source code window. < When Screen Field is Selected : > "When Screen Field is Selected : " In the CASE SELECTED() structure, executed when the field is selected for entry. < When Screen Field is Completed: > "When Screen Field is Completed: " In the CASE FIELD() structure, executed when the field has been completed. Formula Classes < SETUP > SETUP A Conditional or Computed Field with "SETUP" in the Formula Class field is calculated once at the beginning of the procedure before the screen field processing LOOP. < No class (blank) > No class (blank) Calculates the formula every time any field on the screen is completed. The calculation code is generated before the field setup routines at the top of the processing LOOP. <> The "Print" template generates a procedure that prints the report created with the Report Formatter. This template makes no provision for accessing data files. Fields printed on the report reflect their value in memory at the time the procedure is executed. The "Print" template is intended for printing messages or status reports. Formatter Support The "Print" procedure in CLARION.APP is pre-loaded with an empty report layout. Local data is generated before the report structure. Formulas are generated before the OPEN(Report) statement. The Screen and Pulldown Menu Formatters are not supported. Property Fields < Redirect Procedure: > Redirect Procedure: Enter the name of a procedure which is called before the report is generated to allow the user to define the report's destination at runtime. The Print Template assumes that the report's destination is in GLO:FileSpec (a global variable defined in CLARION.APP) after the Redirect Procedure is called. Normally, the Redirect Procedure is created from the Redirect Template. < View Procedure: > View Procedure: Enter the name of a procedure which is called after the report is generated to allow the user to view the report's output (if the user selected the SCREEN or a FILE as the report's destination). Normally, the View Procedure is created from the View Template. The View Template assumes that the report's output filename is in GLO:FileSpec (a global variable defined in CLARION.APP). If the user selected a printer port, the Print Template clears GLO:FileSpec, which disables the View Procedure. Embedded Source Code < Data Section > "Data Section" In the data section of the procedure after local data, the screen and pulldown structures. This may be used to declare any data which you may want to use only in your embedded source code. < Setup Procedure > "Setup Procedure" After the CODE statement. < After Report OPEN before Formulas > "After Report OPEN before Formulas" After the report has been opened, and before any the Formula fields are calculated and before anything is printed. < After Formulas Before Title Page > "After Formulas Before Title Page" After the formulas are calculated, and before anything is printed. < After Grand Totals Before Final Page > "After Grand Totals Before Final Page" After the Title Page and Body Detail have printed, but before the Final Page. < After Final Page Before Close > "After Final Page Before Close" After the Final Page has printed, but before the Report is closed. < End of Procedure > "End of Procedure" Code placed in this window executes after all other code in the procedure has executed. This code begins in column one, therefore you may use this window to write any ROUTINEs which are called from any other embedded source code window. < Detail Pre-Print Code for: > "Detail Pre-Print Code for:" This is an implicit embedded source code window which is executed immediately before the Body detail band is printed. There is only one implicit Detail Pre-Print embedded source code window in the report. < Detail Post-Print Code for: > "Detail Post-Print Code for:" This is an implicit embedded source code window which is executed immediately after the Body detail band is printed. There is only one implicit Detail Post-Print embedded source code window in the report. Formula Classes No formula classes are supported by this procedure Template. All Formulas are generated once without regard to any value in the Formula Class field. <> The "Pulldown" template generates a procedure that displays a pulldown menu used to execute other procedures. Menu items are placed in the menu with the Pulldown Menu Formatter. Once in the Pulldown Menu Formatter, the menu selections which execute procedures must have the "Execute procedure" radio button selected and the procedure to call must be entered. Optionally, source code may be entered instead of a procedure name by deleting any procedure name and selecting the "Source" pushbutton. At least one menu item should have an edit procedure of "RETURN" to exit the "Pulldown" procedure. The code generated by the "Pulldown" procedure template operates like code generated from the "Menu" procedure template. Therefore, the template disables all the fields in any screen that is active and closes the pulldown menu while its selected procedures are executing. A pulldown menu that is designed to work with a screen must be created by the Pulldown Menu Formatter in the procedure that contains the screen. Formatter Support The "Pulldown" procedure in CLARION.APP is pre-loaded with an empty pulldown menu. Local data is generated before the pulldown menu structure. At least one menu item must contain a menu procedure of "RETURN" to exit the pulldown procedure. Formulas are generated at the top of the keyboard loop before the menu item edit routines. The Screen and Report Formatters are not supported. Property Fields < Sticky Menus > [û] Sticky Menus Check this box to generate code that re-selects the last menu item the user selected upon return from the called procedure. < Keep Pulldown Active > [û] Keep Pulldown Active Check this box to keep the Pulldown structure active during the execution of a Pulldown option. Embedded Source < Data Section > "Data Section" In the data section of the procedure after local data, the screen and pulldown structures. This may be used to declare any data which you may want to use only in your embedded source code. < Setup Procedure > "Setup Procedure" After the CODE statement. < Setup Pulldown > "Setup Pulldown" After OPEN(Pulldown). < Top of Accept Loop> "Top of Accept Loop" At the top of the screen field processing loop. < End of Procedure > "End of Procedure" Code placed in this window executes after all other code in the procedure has executed. This code begins in column one, therefore you may use this window to write any ROUTINEs which are called from any other embedded source code window. < Pulldown Item Code for : > Pulldown Item Code for : In the CASE FIELD() structure, executed when the menu item is selected by the user. Formula Classes No formula classes are supported by this procedure Template. <> The "Redirect" template creates a procedure which allows the user to choose a report's destination at runtime. The Template code itself is very basic -- all the functionality is provided in the default procedure in CLARION.APP. There are two local variables declared which are placed on the default screen design. One selects the destination and the other names the disk file if FILE is the selected destination. The functionality of the procedure is completely contained in the embedded source code windows for these two fields and the Ok and Cancel buttons. Once the destination is selected, it is placed in the GLO:FileSpec global variable (as expected by the Report and View Templates). Formatter Support The "Redirect" procedure in CLARION.APP is pre-loaded with a default screen design which allows the user to select any LPT or COM port, the SCREEN, or to name a disk file to receive report output. The Report and Pulldown Menu Formatters are not supported. Formulas are also not supported. Property Fields There are no prompts which are specific to this procedure. Embedded Source < Data Section > "Data Section" In the data section of the procedure, after local data and the screen structure. This may be used to declare any data which you may want to use only in your embedded source code. < Setup Procedure > "Setup Procedure" Immediately after the CODE statement. < Setup Screen > "Setup Screen" Immediately after the OPEN(Screen) statement. < Top of Accept Loop> "Top of Accept Loop" At the top of the screen field processing loop. < End of Procedure > "End of Procedure" Code placed in this window executes after all other code in the procedure has executed. This code begins in column one, therefore you may use this window to write any ROUTINEs which are called from any other embedded source code window. < When Screen Field is Selected : > "When Screen Field is Selected : " In the CASE SELECTED() structure, executed when the field is selected for entry. < When Screen Field is Completed: > "When Screen Field is Completed: " In the CASE FIELD() structure, executed when the field has been completed. Formula Classes Neither Formulas nor Formula Classes are supported by the Redirect Template. <> The "Report" template prints reports from one or multiple related data files. File relationships, both 1:MANY and MANY:1, are automatically handled with some restrictions. The files used for the report are defined in the File Schematic built in the File Schematic Definition window. The first file in the File Schematic is the Primary file, all others are Secondary files. A Secondary Child file (double right arrow) has a 1:MANY relationship with the file to which it is attached in the File Schematic. A Secondary Lookup file (single right arrow) has a MANY:1 relationship with the file to which it is attached in the File Schematic. The template recurses through as many levels of 1:MANY relationships as are defined in the File Schematic, starting with the Primary file, going down the chain of Secondary files beginning with the first Child file of the Primary. This generates a set of nested LOOP structures which read all related records from each file in turn. The Body detail band is printed every time a record from the lowest level Child file is read. A second Child file of the Primary file would begin a second 1:MANY file chain -- this is not supported by this template. The Secondary Lookup (MANY:1) relationship is supported for multiple levels below the file (Primary or Secondary Child) to which it is related -- a lookup will generate a second lookup from it. This File Schematic is directly supported: Primary ÀÄÄ> Secondary (Lookup from Primary) ³ ÀÄÄ> Secondary (Lookup from Lookup) ÀÄÄ> Secondary (Lookup from Primary) ÀÄ>> Secondary (Child of Primary) ÀÄÄ> Secondary (Lookup from Secondary Child) ³ ÀÄÄ> Secondary (Lookup from Lookup) ÀÄÄ> Secondary (Lookup from Secondary Child) ÀÄ>>Secondary (Child of Secondary Child) ÀÄÄ> Secondary (Lookup from Secondary Child) This File Schematic is NOT directly supported: Primary ÀÄÄ> Secondary (Lookup from Primary) ³ ÀÄ>>Secondary (Child of Lookup) -- NO Children of Lookups ÀÄ>>Secondary (Child of Primary) ³ ÀÄÄ> Secondary (Lookup from Secondary Child) ÀÄ>>Secondary (Child of Primary) -- NO 2nd Child chains This template supports multiple Group Breaks per Primary or Secondary Child file. The code to print the group break is generated as a ROUTINE called from within the nested LOOP structure after a record is read from the file for which the group break is defined. Record filters are supported on the Primary and every Secondary Child file (see the Formula Class topic below). Multi-Up labels are supported -- they must be defined in the Body Detail band. Formatter Support The "Report" procedure in CLARION.APP is pre-loaded with an empty report layout. Line counter, Page counter, and Report Device variables are defined in local data, and the Report Properties window uses these local variables (the line counter is required by the template). 'GENERIC PRINTER' is the default printer selected from the PRINTER.CTL file. If you place anything in the Title Page band and intend that it should print without first printing the Page Header (or Footer), you must check the ALONE attribute in the Title Page's Band Properties window. The Screen Formatter contains a default screen which is included in the generated source code only if the Show Report Progress box is checked. The screen contains display-only fields for the Line Counter and Page Counter. The values in these two fields are displayed after each PRINT statement in the Report. The Pulldown Menu Formatter is not supported by the Report Template. Property Fields < Enable ESC Key Abort: > Enable ESC Key Abort: Check this box to include code to allow the user to abort the report at runtime by pressing the ESC key. < Show Report Progress: > Show Report Progress: Check this box to display the screen defined in the Screen Formatter as the report is being generated. This allows the user to clearly see that the report is being generated (especially if it is directed to a disk file). < CLEAR Record First: > CLEAR Record First: Check this box to issue a CLEAR statement for the Primary file before the SET statement which initiates sequential processing. This allows you to choose between initializing key fields in the Report procedure, or calling the Report from another procedure which allows the user to select or input the correct key field starting values. < Primary File Access: > Primary File Access: Select the radio button which defines the type of access you want to the Primary file. If you select Keyed Order, the Primary file's Access Key set on the Field Selection window is used to access the file and a Range Limit Field may be specified. If you select Record Order, the Primary file is accessed in physical, record-number, order and any Range Limit Field is ignored. < Range Limit Field: > Range Limit Field: The records to be printed from the Primary file can be limited by fixing the value of a component of the Primary file access key. Only those records whose key component value is equal to the value in the Range Value Field will be printed. You must select a key component field of the Primary file's access key you defined in the File Schematic. < Range Value Field: > Range Value Field: Select the field which, at run-time, will contain the value to which you want the report's Primary file to be limited. The value in this field will be assigned to the key component field you specified in the Range Limit Field before the SET statement for the Primary file. < Redirect Procedure: > Redirect Procedure: Enter the name of a procedure which is called before the report is generated to allow the user to define the report's destination at runtime. The Report Template assumes that the report's destination is in GLO:FileSpec (a global variable defined in CLARION.APP) after the Redirect Procedure is called. Normally, the Redirect Procedure is created from the Redirect Template. < View Procedure: > View Procedure: Enter the name of a procedure which is called after the report is generated to allow the user to view the report's output (if the user selected the SCREEN or a FILE as the report's destination). Normally, the View Procedure is created from the View Template. The View Template assumes that the report's output filename is in GLO:FileSpec (a global variable defined in CLARION.APP). If the user selected a printer port, the Report Template clears GLO:FileSpec, which disables the View Procedure. Embedded Source < Data Section > "Data Section" In the data section of the procedure, after local data and the report structure. This may be used to declare any data which you may want to use only in your embedded source code. < Setup Procedure > "Setup Procedure" Immediately after the CODE statement. < After Report OPEN before Title Page > "After Report OPEN before Title Page" After all files in the report are opened and the report is opened, but before anything is printed. < Immediately before SET(key,key) > "Immediately before SET(key,key)" Immediately after the Range Value field has been assigned to the Range Limit field and before the SET statement which establishes the report's starting position in the file. This allows you to correctly initialize any other fields in the Primary File Access Key before the SET statement. If Range Limit and Range Value fields are not specified, no source code is generated from this Embedded Source window. < Before Primary LOOP after SET > "Before Primary LOOP after SET" After the SET statement which sets up the order and starting point on the Primary file, but before the LOOP which processes the Primary file records. < Top of Primary LOOP > "Top of Primary LOOP" Immediately after the LOOP statement which processes the Primary file and before any other statement in the LOOP. Code placed here will execute every time through the LOOP. < In Primary LOOP immediately after NEXT > "In Primary LOOP immediately after NEXT" Code placed in this window executes immediately after each Primary file record is read and before any group break code is executed. If you code your own record filter at this point instead of using a Pre:FILTER class Formula, it would be a good idea to check ERRORCODE() to detect the end of file condition (if you don't, you could create an infinite loop). < In Primary LOOP after NEXT before Lookups > "In Primary LOOP after NEXT before Lookups" Code placed in this window executes after each Primary file record is read and any group break code is executed, but before any Record Filter, Lookups, or Formulas. < In Primary LOOP after Lookups > "In Primary LOOP after Lookups" Code placed in this window executes after any Record Filter, Lookups, or Formulas from the Primary file, but before any related Child records are accessed. < After Primary LOOP before Grand Totals and Final Page > "After Primary LOOP before Grand Totals and Final Page" Code placed in this window executes after all records from all files have been processed, but before the Grand Totals and Final Page bands are printed. < End of Procedure > "End of Procedure" Code placed in this window executes after all other code in the procedure has executed. At this point, the Report is closed. This code begins in column one, therefore you may use this window to write any ROUTINEs which are called from any other embedded source code window. < When Screen Field is Selected : > "When Screen Field is Selected : " The Report Template does not support screen processing during generation of the report. Code placed here is not generated. < When Screen Field is Completed: > "When Screen Field is Completed: " The Report Template does not support screen processing during generation of the report. Code placed here is not generated. < Group Header Pre-Print Code for: > "Group Header Pre-Print Code for:" This is an implicit embedded source code window which is executed immediately before the header for the group break referenced is printed. There is one implicit Group Header Pre-Print embedded source code window for each group break defined in the Report Formatter. < Group Header Post-Print Code for: > "Group Header Post-Print Code for:" This is an implicit embedded source code window which is executed immediately after the header for the group break referenced is printed. There is one implicit Group Header Post-Print embedded source code window for each group break defined in the Report Formatter. < Group Footer Pre-Print Code for: > "Group Footer Pre-Print Code for:" This is an implicit embedded source code window which is executed immediately before the footer for the group break referenced is printed. There is one implicit Group Footer Pre-Print embedded source code window for each group break defined in the Report Formatter. < Group Footer Post-Print Code for: > "Group Footer Post-Print Code for:" This is an implicit embedded source code window which is executed immediately after the footer for the group break referenced is printed. There is one implicit Group Footer Post-Print embedded source code window for each group break defined in the Report Formatter. < Detail Pre-Print Code for: > "Detail Pre-Print Code for:" This is an implicit embedded source code window which is executed immediately before the Body detail band is printed. There is only one implicit Detail Pre-Print embedded source code window in the report. < Detail Post-Print Code for: > "Detail Post-Print Code for:" This is an implicit embedded source code window which is executed immediately after the Body detail band is printed. There is only one implicit Detail Post-Print embedded source code window in the report. Formula Classes < SETUP> SETUP A Conditional or Computed Field with "SETUP" in the Formula Class field is calculated once at the beginning of the procedure, immediately after the "After Report OPEN before Title Page" embedded source point. < Pre:FILTER> Pre:FILTER The prefix of the Primary or a Secondary Child file (not a Lookup file) with :FILTER appended (Pre:FILTER): This creates a record filter to skip over records in which the filter expression does not evaluate as true, just after the file's record is read. Only the Formula expression (in a Computed Field), or the Condition expression (in a Conditional Field) is used to generate the filter expression. No other information from the Formula field is used in the filter (any If True or If False expressions are ignored and the Field Name is not used -- this may be a "dummy" field). < FileName> FileName The name of the Primary or a Secondary Child file (not a Lookup file) in the File Schematic. This calculates the formula only when a record read from the named file -- this comes after any Pre:FILTER expression on the file is evaluated and any Lookup records are read. < BreakField> BreakField The name of a Group Break field (including prefix). This calculates the formula just before the Group Footer is printed. This is useful for formulas calculating expressions which include one or more Report Total fields. The formula's destination variable should be placed in the group footer. < No class (blank) > No class (blank) Calculates the formula every time a record is read from any file. <> The "Screen" template generates a procedure that processes a screen created with the Screen Formatter. The template generates code for Range checks and enforces 'Must be in File' from the dictionary. The "Screen" template is intended for displaying status windows or updating memory variables. Formatter Support The "Screen" procedure in CLARION.APP is pre-loaded with an empty screen layout. Local data is generated before the screen structure. If a pulldown structure has been created by the Pulldown Menu Formatter, it is generated after the screen structure. The template makes no provision for opening or closing a pulldown menu. Such statements must be entered as embedded source. Statements from the Formula Formatter are generated at the top of the keyboard loop before the field setup routines. The Report Formatter is not supported. Embedded Source < Data Section > "Data Section" In the data section of the procedure, after local data and the report structure. This may be used to declare any data which you may want to use only in your embedded source code. < Setup Procedure > "Setup Procedure" After the CODE statement. < Setup Screen > "Setup Screen" After OPEN(Screen). < Top of Accept Loop> "Top of Accept Loop" At the top of the screen field processing loop. < End of Procedure > "End of Procedure" Code placed in this window executes after all other code in the procedure has executed. At this point, the Report is closed. This code begins in column one, therefore you may use this window to write any ROUTINEs which are called from any other embedded source code window. < When Screen Field is Selected : > "When Screen Field is Selected : " In the CASE SELECTED() structure, executed when the field is selected for entry. < When Screen Field is Completed: > "When Screen Field is Completed: " In the CASE FIELD() structure, executed when the field has been completed. Formula Classes No formula classes are supported by this procedure Template. All formulas are generated within the main LOOP before the ACCEPT statement. <> The "Select" template generates a procedure that allows a user to select a record from a scrolling list of records. Once the record is selected it is loaded into memory. You may then call another procedure to take an action on the selected record. For example a print procedure may be called which prints the current record from memory. The Select template is a modified Browse template procedure to allow a user to either select a record, or cancel the selection. Upon selection of the Cancel button, the record buffer is cleared. This gives the programmer the ability to check for a blank record. In the print example, the programmer may select to not print if the record is blank. A set of display-only fields can be designated as "hot fields" on screen. Hot fields display values from the record currently highlighted by the selector bar and change whenever the selector bar moves. This allows display of more information from the highlighted record than just the one line in the List box. These hot fields MUST appear consecutively in the Field List but may be placed anywhere on screen. An optional locator field finds a specific record in the file. Typing any character while the LIST field is active selects the locator field. Completing the locator field with a TAB key or mouse CLICK displays the closest matching record at the top of the list box. Another option is an "incremental locator", which allows a half-second pause for user entry into a locator field, and then automatically finds the closest matching record to the contents in the locator field. The backspace key is active during this process. For numeric data types, it is recommended to use a string picture type (for display purposes). Date fields are not recommended for incremental locators. See the Browse template help for full details on the specific operation of the scrolling listbox and the pushbuttons. Formatter Support The "Select" template in CLARION.APP is pre-loaded with a screen layout containing a list box and pushbuttons named "Insert", "Change", "Delete", "Select" and "Cancel". The field equate label of the list box MUST be "?List" and the "Immediate" attribute MUST be on turned on. The horizontal scroll bar can be turned off if the required information fits in the list box. The vertical scroll bar is ignored by the template. The list box may not have an edit procedure. All other properties of the list box can be changed. Fields from related files may be scrolled in the listbox as "lookups" will be done automatically from the Primary file in the file schematic. The "Insert", "Change", and "Delete" pushbuttons call an update procedure to process the selected record (update procedures are normally created with a "Form" or "MultiPage" template). The name of the procedure must be entered as the "Update Procedure" property. If there is no update procedure, these pushbuttons can be deleted. If all three pushbuttons are deleted and you have named an update procedure, the INSERT, ENTER and DELETE keys will Insert, Change, and Delete records while the list box is selected. However, if only one or two of these buttons have been removed, the function of that button (Insert, Change, or Delete) will be removed from the list box as well and no update procedure will be called for that function. The "Select" and "Cancel" pushbuttons should not be deleted. Local data is generated before the screen structure. If a pulldown structure has been created by the Pulldown Menu Formatter, it is generated after the screen structure. The template makes no provision for opening or closing a pulldown menu. Such statements must be entered as embedded source. The Report Formatter is not supported. Property Fields < Range Limit Field: > Range Limit Field: The range of records to be displayed can be limited by fixing the value of a component of the primary file access key. For example, line items on an invoice can be limited to a single invoice. The key for the item file might contain ITM:Invoice and ITM:Line containing the invoice number and line number of the item. ITM:Invoice would be the Range Limit Field, displaying only those records for a fixed invoice number. < Range Value Field: > Range Value Field: The Range Value Field is the field which holds the value to be used as the limiting key component value. The key component will be assigned this value. In this example, the current Invoice record might contain the number of the invoice that is being displayed. INV:Number would be the Range Value Field, supplying the value for the Range Limit Field. The Range Value Field must not be the same field as the Range Limit Field. < Record Filter:> Record Filter: There are 2 ways to enter a record filter: The formula generator can be used with a formula class of 'FILTER' to validate the expression as entered. Enter a free-form record filter expression in this field. No validation is done on the code you enter -- an invalid expression will generate compiler errors. If you are not familiar with the Clarion language statements or expressions, do not use this entry -- use a Formula field with the FILTER Formula Class instead. < Locator Field: > Locator Field: A locator field is a screen entry field that updates a component of the primary file access key. When a locator field is entered, the closest matching record is displayed in the list box. For example, scrolling a vendor file in vendor name sequence uses a key that contains the vendor name field (e.g. VND:Name). To create a vendor name locator field, place a VND:Name entry field on the screen below the list box and enter VND:Name for the Locator Field. Once the user types a character on the keyboard, the locator field is selected and allows entry for the match. Pressing the Tab key positions the point bar to the closest match. Another option is "Incremental Locator". This template option allows one-half second for the user to type a new letter into the locator field. At each pause longer than one-half second, the field contents are used to locate the closest match (the Tab key does not need to be pressed). The backspace key is active during this process. < Incremental Locator > [û] Incremental Locator Check this box to indicate that the Locator Field will act as an incremental locator. < Update Procedure: > Update Procedure: Enter the name of the update procedure to be used to insert, change, or delete records. If no update procedure is entered, the "Insert", "Change", and "Delete" pushbuttons should be removed from the screen layout. < First Hot Field: > First Hot Field: Hot fields are a set of display-only fields that display the contents of the record under the selector bar. They must appear consecutively in the Field List. Enter the name of the first hot field. < Last Hot Field: > Last Hot Field: Enter the name of the last hot field. < Enable Hot Records > [û] Enable Hot Records By enabling hot records the programmer has complete control at every list box movement from the Browse manager. With this option enabled, every movement of the point bar gets the record under the point bar into memory, looks up any many to one secondary files, computes any general formulas and executes any embedded source code which was entered in the 'Process Selected Record' code window. < Enable Total Embeds > [û] Enable Total Embeds Check this box to generate total field code, without the need for dummy formula fields. Otherwise, you must define a total field with a formula class of SUM or AVG. Embedded Source < Data Section > "Data Section" In the data section of the procedure after local data, the screen and pulldown structures. This may be used to declare any data which you may want to use only in your embedded source code. < Setup Procedure > "Setup Procedure" After the CODE statement. < Setup Screen > "Setup Screen" After OPEN(Screen) statement. < Setup Pulldown> "Setup Pulldown" After OPEN(PullDown) statement. < Set to First Record Before Total Loop> "Set to First Record Before Total Loop" After the SET(key,key) for Range limits before beginning the total calculation LOOP. < Inside Total Loop, Immediately after NEXT> "Inside Total Loop, Immediately after NEXT" Immediately after each record is read in the total calculation LOOP. < Inside Total Loop after Filter> "Inside Total Loop after Filter" After each record is read and filter conditions are evaluated in the total calculation LOOP. < After Total Field Loop> "After Total Field Loop" After all totals have been calculated. < LIST Class Formula> "LIST Class Formula" After generation of LIST class formulas. This embedded code window may be used instead of LIST class formulas. This will allow setting up any fields which are displayed within the scrolling listbox. < End of General Formulas> "End of General Formulas" When processing a screen field, the formulas which do not have a class of 'FILTER' of 'LIST' will be generated. This embedded source window allows the entry of computations for screen display fields without the use of the formula formatter. < Case of No Records Found> "Case of No Records Found" When no records are found to display. < After Filter and Range Check> "After Filter and Range Check" After any record filter or Range limits are evaluated. < Set to First Record> "Set to First Record" When using Range Limits, a SET() command is issued to locate the first record. This embedded source code window appears just after the generated SET() command and allows a programmer override of the SET() command. < Set to Last Record> "Set to Last Record" When using Range Limits, a SET() command is used to locate the closest match to the last record. This embedded source code window appears just after the generated SET() command and allows a programmer override of the SET() command. < Process Selected Record> "Process Selected Record" When Enable Hot Records has been checked, code within this embedded source window will be executed upon movement of the point bar. The record under the point bar will be retrieved into memory, any many to one secondary file records will be retrieved and any general formulas will be computed just prior to the insertion of this embedded source code. < End of Procedure> "End of Procedure" Code placed in this window executes after all other code in the procedure has executed. This code begins in column one, therefore you may use this window to write any ROUTINEs which are called from any other embedded source code window. < Prior to Update Procedure> "Prior to Update Procedure" Immediately before the Update Procedure is called. < After Update Procedure> "After Update Procedure" Immediately after return from the Update Procedure. < When Screen Field is Selected : > "When Screen Field is Selected : " In the CASE SELECTED() structure, executed when the field is selected for entry. < When Screen Field is Completed: > "When Screen Field is Completed: " In the CASE FIELD() structure, executed when the field has been completed. Formula Classes < FILTER > FILTER A Conditional Field with "FILTER" in the Formula Class field is used to select which records are displayed. If the Condition expression evaluates to zero (false) for a given record, it is not displayed. < LIST > LIST A Conditional or Computed Field with "LIST" in the Formula Class field is used for those values which will be displayed in the list box and are only evaluated when the list box item is created. < SUM > SUM A Computed Field with "SUM" in the Formula Class field calculates the total of the values contained in the field named in the Expression. A Conditional Field with "SUM" in the Formula Class field conditionally calculates the total of the values contained in the fields named in the True and False Expressions. < AVG > AVG A Computed Field with "AVG" in the Formula Class field calculates the arithmetic mean of the field named in the Expression. A Conditional Field with "AVG" in the Formula Class field conditionally calculates the arithmetic mean of the fields named in the True and False Expressions. In both cases, the total value is calculated, then divided by the number of records read to achieve that total. < No class (blank) > No class (blank) Calculates the formula every time any field on the screen is completed. The calculation code is generated before the field setup routines at the top of the processing LOOP. <> The "Source" template generates a procedure comprised only of embedded source code. All executable statements in the procedure, must be entered at the embedded source point labeled "All Executable Source Code". The source entered must contain (at least) a RETURN statement. The "Source" template is intended for procedures that cannot be generated by any other template. Formatters Supported The "Source" template does not support the Application Generator's Screen, Report, Pulldown Menu, or Formula formatters. However, the Text Editor's Screen, Report, and Pulldown Menu Formatters can be invoked while entering embedded source in the Data Section. Property Fields < Prototype:> Prototype: Enter the procedure's prototype (all except the procedure's name) to be placed in the program's MAP structure. For example, if your procedure is a FUNCTION called MyProc and it will receive two parameters -- a STRING and a BYTE passed by address -- and return a STRING, you would enter : (STRING,*BYTE),STRING See FUNCTION and PROCEDURE Prototypes in the Language Reference for a discussion of valid prototypes. < Parameter List:> Parameter List: Enter the complete parameter list (including parentheses) to be placed on the procedure's PROCEDURE or FUNCTION statement. This labels the passed parameters for reference within the procedure. For the above example, you could enter: (Fred,Joe) The generated source code for the procedure would look like: MyProc FUNCTION(Fred,Joe) In your executable code, you would reference the STRING parameter as "Fred" and the BYTE as "Joe." Embedded Source < Data Section > "Data Section" In the data section of the procedure, after local data. This may be used to declare any data which you may want to use in your embedded source code. < All Executable Source Code > "All Executable Source Code" All executable statements in the procedure must go in here. Formula Classes No formula classes are supported by this procedure Template. Formula fields are not supported. <> The "Table21" template generates a procedure that scrolls data files on the screen like a spreadsheet. Unlike the List or Browse templates, the Table uses a REPEAT structure instead of a list box. Table is similar to the Browse template, but allows you the flexibility of coloring individual screen fields and displaying multi-line individual records. The Table21 Template is provided for compatibility with the Clarion Professional Developer version 2.1-style TABLE procedures. When you import a TABLE procedure from a 2.1 .APP file, this template is used but the BUTTON fields in the default screen design are not generated (maintaining 2.1 compatibility). Keystrokes for insert, change, and delete will be retained. BUTTON fields are supported, but are not created in the conversion process. A Table21 procedure receives an omittable BYTE parameter that defines the procedure's use at runtime: "Standard mode" or "Select mode." "Standard mode" means no parameter was passed. Therefore, the procedure acts the same as all other Browse-type procedures: when the user presses Enter on a highlighted record, the Update Procedure is called; the Delete and Insert buttons are active; and, if a "Select" button exists, it is dimmed. This duplicates the action of a version 2.1 TABLE that is not called as a "lookup." "Select mode" means a value of four (SelectRecord = 4) was passed as the parameter and allows the Select button to be active. When an item is selected, its record is read from disk into the record buffer and the Table21 procedure returns to the calling procedure. This duplicates the action of a version 2.1 "lookup" TABLE. The hot key for the Change and Select buttons should be EnterKey. Formatter Support The "Table21" procedure in CLARION.APP is pre-loaded with a screen layout with a REPEAT structure containing a POINT field and pushbuttons named "Insert," "Change," "Delete," and "Exit." These buttons are not created when importing a 2.1 TABLE from a 2.1 .APP file. If a pulldown structure has been created in the Pulldown Menu Formatter, it is generated after the screen structure. The template makes no provision for opening or closing a pulldown menu. Such statements must be entered as embedded source. The Report Formatter is not supported. Property Fields < Range Limit Field:> Range Limit Field: The range of records to be displayed can be limited by fixing the value of a component of the primary file access key. For example, line items on an invoice can be limited to a single invoice. The key for the item file might contain ITM:Invoice and ITM:Line containing the invoice number and line number of the item. ITM:Invoice would be the Range Limit Field, displaying only those records for a fixed invoice number. < Range Value Field:> Range Value Field: The Range Value Field is the field which holds the value to be used as the limiting key component value. The key component will be assigned this value. In this example, the current Invoice record might contain the number of the invoice that is being displayed. INV:Number would be the Range Value Field, supplying the value for the Range Limit Field. The Range Value Field must not be the same field as the Range Limit Field. < Record Filter:> Record Filter: There are 2 ways to enter a record filter: The formula generator can be used with a formula class of 'FILTER' to validate the expression as entered. Enter a free-form record filter expression in this field. No validation is done on the code you enter -- an invalid expression will generate compiler errors. If you are not familiar with the Clarion language statements or expressions, do not use this entry -- use a Formula field with the FILTER Formula Class instead. < Locator Field: > Locator Field: A locator field is a screen entry field that updates a component of the primary file access key. When a locator field is entered, the closest matching record is displayed in the list box. For example, scrolling a vendor file in vendor name sequence uses a key that contains the vendor name field (e.g. VND:Name). To create a vendor name locator field, place a VND:Name entry field on the screen below the list box and enter VND:Name for the Locator Field. Once the user types a character on the keyboard, the locator field is selected and allows entry for the match. Pressing the Tab key positions the point bar to the closest match. Another option is "Incremental Locator". This template option allows one-half second for the user to type a new letter into the locator field. At each pause longer than one-half second, the field contents are used to locate the closest match (the Tab key does not need to be pressed). The backspace key is active during this process. < Incremental Locator > [û] Incremental Locator Check this box to indicate that the Locator Field will act as an incremental locator. < Update Procedure:> Update Procedure: Enter the name of the update procedure to be used to insert, change, or delete records. If no update procedure is entered, the "Insert", "Change", and "Delete" pushbuttons should be removed from the screen layout. Special considerations may exist when using ASCII, DOS, and BASIC file drivers. In some cases a PUT or DELETE is not allowed. See the file driver's documentation for file driver specifics. < First Hot Field:> First Hot Field: Hot fields are a set of display-only fields that display the contents of the record under the selector bar. They must appear consecutively in the Field List. Enter the name of the first hot field. < Last Hot Field:> Last Hot Field: Enter the name of the last hot field. Embedded Source < Data Section> "Data Section" In the data section of the procedure after local data, the screen and pulldown structures. This may be used to declare any data which you may want to use only in your embedded source code. < Setup Procedure> "Setup Procedure" After the CODE statement. < Setup Screen> "Setup Screen" After OPEN(Screen) statement. < LIST Class Formula> "LIST Class Formula" After generation of LIST class formulas. This embedded code window may be used instead of LIST class formulas. This will allow setting up any fields which are displayed within the scrolling table. < End of General Formulas> "End of General Formulas" When processing a screen field, the formulas which do not have a class of 'FILTER' of 'LIST' will be generated. This embedded source window allows the entry of computations for screen display fields without the use of the formula formatter. < End of Procedure> "End of Procedure" Code placed in this window executes after all other code in the procedure has executed. This code begins in column one, therefore you may use this window to write any ROUTINEs which are called from any other embedded source code window. < When Screen Field is Selected : > "When Screen Field is Selected : " In the CASE SELECTED() structure, executed when the field is selected for entry. < When Screen Field is Completed: > "When Screen Field is Completed: " In the CASE FIELD() structure, executed when the field has been completed. Formula Classes < FILTER > FILTER A Conditional Field with "FILTER" in the Formula Class field is used to select which records are displayed. If the Condition expression evaluates to zero (false) for a given record, it is not displayed. Enter the expression for the Conditional field and leave the True and False conditions blank. Only the Expression will be used for the filter. A filter expression may be entered in the Record Filter property field instead of using the formula formatter. < LIST > LIST A Conditional or Computed Field with "LIST" in the Formula Class field is used for those values which will be displayed in the scrolling table and are only evaluated when the Table is built. < SUM > SUM A Computed Field with "SUM" in the Formula Class field calculates the total of the values contained in the field named in the Expression. A Conditional Field with "SUM" in the Formula Class field conditionally calculates the total of the values contained in the fields named in the True and False Expressions. < AVG > AVG A Computed Field with "AVG" in the Formula Class field calculates the arithmetic mean of the field named in the Expression. A Conditional Field with "AVG" in the Formula Class field conditionally calculates the arithmetic mean of the fields named in the True and False Expressions. In both cases, the total value is calculated, then divided by the number of records read to achieve that total. < No class (blank) > No class (blank) Calculates the formula every time any field on the screen is completed. The calculation code is generated before the field edit routines at the top of the field processing code. <> The "ToDo" template should not be selected for code generation. Procedures, when first referenced, are automatically created as ToDo until the template for code generation is selected. No operation "Stub code" is generated for procedures which remain as "ToDo" at source generation time. <> This Template is not yet implemented. <> The "Validate" template generates a procedure that will be used to perform entry field validation. The procedure MUST be called as the "When Field is Completed" Procedure on the entry field to validate. When the entry field has been completed, the Validate procedure will be called to check for the existence of the value in the current field against the specified key. If no match is found, a screen with a list box is presented to allow the user to select a valid entry. Selected fields from the data file are displayed as columns in a list box. Columns that do not fit in the list box are displayed using the horizontal scroll bar or the left and right arrow keys. A selector bar is always positioned over a single row. The up and down arrow keys move the selector bar. Moving the selector bar up off the top row or down off the bottom row scrolls a new record into the list box. The PGUP and PGDN keys scroll the prior and next pages of records into the list box. CTRL-PGUP displays the first page of records and CTRL-PGDN displays the last page of records. Pressing the right mouse button in the top half of the list box scrolls up and in the bottom half scrolls down. The ENTER key and the mouse DOUBLE-CLICK selects the highlighted record and completes the procedure. The Validate Template uses PRESS to place the selected value into the entry field it was called to validate. Therefore, if numeric data is being validated, the typing mode of that field should be INSERT. This allows PRESS to put the correct value into the field. The "Select", "Insert" and "Change" pushbuttons, or any other field that processes the record under the selector bar MUST be placed after the LIST field in the Field List. An optional locator field finds a specific record in the file. Typing any letter while the LIST field is active selects the locator field. Completing the locator field with a Tab key or mouse click displays the closest matching record at the top of the list box. A set of display-only fields can be designated as "hot fields" on screen. Hot fields display values from the record currently highlighted by the selector bar and change whenever the selector bar moves. This allows display of more information from the highlighted record than just the one line in the List box. These hot fields MUST appear consecutively in the Field List but may be placed anywhere on screen. When you define a SUM or AVG formula class, total field code generation is automatically enabled. Formatter Support The "Validate" procedure in CLARION.APP is pre-loaded with a screen layout containing a list box and pushbuttons named "Select", "Insert", and "Change". The field equate label of the list box MUST be "?List" and the "Immediate" attribute MUST be on turned on. The horizontal scroll bar can be turned off if the required information fits in the list box. All other properties of the list box can be changed. Fields from related files may be scrolled in the list box as "lookups" will be done automatically from the Primary file in the file schematic to Secondary files with a "Many to 1" relationship. "1 to Many" relationships are not supported by this procedure Template. The "Insert" and "Change" pushbuttons call an update procedure to process the selected record (normally created with a "Form" template). The name of the procedure must be entered as the "Update Procedure". If there is no update procedure entered, these pushbuttons may be deleted. The ENTER key and mouse DOUBLE-CLICK while on the listbox will select the record under the selector bar and enter the value in the entry field. Local data is generated before the screen structure. If a pulldown structure has been created by the Pulldown Menu Formatter, it is generated after the screen structure. The template makes no provision for opening or closing a pulldown menu (you must write embedded source for this). Property Fields < Range Limit Field: > Range Limit Field: The range of records to be displayed can be limited by fixing the value of a component of the primary file access key. For example, line items on an invoice can be limited to a single invoice. The key for the item file might contain ITM:Invoice and ITM:Line containing the invoice number and line number of the item. ITM:Invoice would be the Range Limit Field, displaying only those records for a fixed invoice number. < Range Value Field: > Range Value Field: The Range Value Field is the field which holds the value to be used as the limiting key component value. The key component will be assigned this value. In this example, the current Invoice record might contain the number of the invoice that is being displayed. INV:Number would be the Range Value Field, supplying the value for the Range Limit Field. The Range Value Field must not be the same field as the Range Limit Field. < Record Filter:> Record Filter: There are 2 ways to enter a record filter: The formula generator can be used with a formula class of 'FILTER' to validate the expression as entered. Enter a free-form record filter expression in this field. No validation is done on the code you enter -- an invalid expression will generate compiler errors. If you are not familiar with the Clarion language statements or expressions, do not use this entry -- use a Formula field with the FILTER Formula Class instead. < Lookup Field: > Lookup Field: Enter the name of the field to be used to validate against your entry field. This field should be the only field in a single-component unique key. < Input Field Picture: > Input Field Picture: Some fields do not appear on screen in the same format as the data exists in the file (and in the key). These fields must have an Input Field Picture to DEFORMAT the data for validation and to FORMAT the selected data for on-screen display. Enter the display picture to DEFORMAT the data for validation. This picture is also used to FORMAT the data to PRESS it into the keyboard buffer and fill the entry field when a record is selected from this procedure's list. Examples of fields which require an Input Field Picture: Any STRING, CSTRING, or PSTRING with an implied decimal storage picture (for example, @N6v2). Any numeric data field (LONG, DATE, USHORT, etc.) with a date (@D1, @D2, etc.) or time (@T1, @T2, etc.) display picture. Any numeric data field (REAL, BFLOAT, etc.) with a display picture which includes a decimal portion (for example, @N6.2). < Locator Field: > Locator Field: A locator field is a screen entry field that updates a component of the primary file access key. When a locator field is entered, the closest matching record is displayed in the list box. For example, scrolling a vendor file in vendor name sequence uses a key that contains the vendor name field (e.g. VND:Name). To create a vendor name locator field, place a VND:Name entry field on the screen below the list box and enter VND:Name for the Locator Field. Once the user types a character on the keyboard, the locator field is selected and allows entry for the match. Pressing the Tab key positions the point bar to the closest match. < Display Key: > Display Key: If using one key for entry field validation and another key as the display key, enter the name of the display key here. Otherwise, leave this field blank. < Update Procedure: > Update Procedure: Enter the name of the update procedure to be used to insert, change, or delete records. If no update procedure is entered, the "Insert" and "Change" pushbuttons should be removed from the screen layout. < First Hot Field: > First Hot Field: Hot fields are a set of display-only fields that display the contents of the record under the selector bar. They must appear consecutively in the Field List. Enter the name of the first hot field. < Last Hot Field: > Last Hot Field: Enter the name of the last hot field. < Enable Hot Records > [û] Enable Hot Records By enabling hot records the programmer has complete control at every list box movement from the Browse manager. With this option enabled, every movement of the point bar gets the record under the point bar into memory, looks up any many to one secondary files, computes any general formulas and executes any embedded source code which was entered in the 'Process Selected Record' code window. < Lookup Hot Key: > Lookup Hot Key: When the Validate procedure is being called by a hot key, enter the hot key here. When a hot key is entered and the hot key is detected upon entry of the Validate procedure, the screen will be opened. No validation check will be done prior to the open of the screen. Embedded Source < Data Section> "Data Section" In the data section of the procedure after local data, the screen and pulldown structures. This may be used to declare any data which you may want to use only in your embedded source code. < Setup Procedure> "Setup Procedure" After the CODE statement. < Before Validate Lookup> "Before Validate Lookup" After opening the primary file, you may enter source code in this window to pre-fill any fields which will be used by the lookup other than the Lookup Field. < Setup Screen> "Setup Screen" After OPEN(Screen). < Setup Pulldown> "Setup Pulldown" After OPEN(PullDown) statement. < Set to First Record Before Total Loop> "Set to First Record Before Total Loop" After the SET(key,key) for Range limits before beginning the total calculation LOOP. < Inside Total Loop, Immediately after NEXT> "Inside Total Loop, Immediately after NEXT" Immediately after each record is read in the total calculation LOOP. < Inside Total Loop after Filter> "Inside Total Loop after Filter" After each record is read and filter conditions are evaluated in the total calculation LOOP. < After Total Field Loop> "After Total Field Loop" After all totals have been calculated. < LIST Class Formula> "LIST Class Formula" After generation of LIST class formulas. This embedded code window may be used instead of LIST class formulas. This will allow setting up any fields which are displayed within the scrolling listbox. < End of General Formulas> "End of General Formulas" When processing a screen field, the formulas which do not have a class of 'FILTER' of 'LIST' will be generated. This embedded source window allows the entry of computations for screen display fields without the use of the formula formatter. < Case of No Records Found> "Case of No Records Found" When no records are found to display. < After Filter and Range Check> "After Filter and Range Check" After any record filter or Range limits are evaluated. < Set to First Record> "Set to First Record" When using Range Limits, a SET() command is issued to locate the first record. This embedded source code window appears just after the generated SET() command and allows a programmer override of the SET() command. < Set to Last Record> "Set to Last Record" When using Range Limits, a SET() command is used to locate the closest match to the last record. This embedded source code window appears just after the generated SET() command and allows a programmer override of the SET() command. < Process Selected Record> "Process Selected Record" When Enable Hot Records has been checked, code within this embedded source window will be executed upon movement of the point bar. The record under the point bar will be retrieved into memory, any many to one secondary file records will be retrieved and any general formulas will be computed just prior to the insertion of this embedded source code. < End of Procedure> "End of Procedure" Code placed in this window executes after all other code in the procedure has executed. This code begins in column one, therefore you may use this window to write any ROUTINEs which are called from any other embedded source code window. < Prior to Update Procedure> "Prior to Update Procedure" Immediately before the Update Procedure is called. < After Update Procedure> "After Update Procedure" Immediately after return from the Update Procedure. < When Screen Field is Selected : > "When Screen Field is Selected : " In the CASE SELECTED() structure, executed when the field is selected for entry. < When Screen Field is Completed: > "When Screen Field is Completed: " In the CASE FIELD() structure, executed when the field has been completed. Formula Classes < LIST > LIST A Conditional or Computed Field with "LIST" in the Formula Class field is used for those values which will be displayed in the list box and are only evaluated when the list box item is created. < SUM > SUM A Computed Field with "SUM" in the Formula Class field calculates the total of the values contained in the field named in the Expression. A Conditional Field with "SUM" in the Formula Class field conditionally calculates the total of the values contained in the fields named in the True and False Expressions. < AVG > AVG A Computed Field with "AVG" in the Formula Class field calculates the arithmetic mean of the field named in the Expression. A Conditional Field with "AVG" in the Formula Class field conditionally calculates the arithmetic mean of the fields named in the True and False Expressions. In both cases, the total value is calculated, then divided by the number of records read to achieve that total. < No class (blank) > No class (blank) Calculates the formula every time any field on the screen is completed. The calculation code is generated before the field setup routines at the top of the processing LOOP. <> The View Template displays any ASCII text file in a scrolling list box. It is normally used to display a report to the screen that was previously written to disk. The View template may be used to create a procedure which is the Next Procedure of a File template. This will allow the user to select a file to view from a list of available files. The text will scroll up or down using the up and down arrow keys or the vertical scroll bar. Pressing the right mouse button in the top half of the list box scrolls up and in the bottom half scrolls down. Left and right scrolling is supported with END, HOME, the horizontal scroll bar, or the left and right arrow keys. The DOS File definition is defined in the template. The record (one line of the report) is defined with a length of 255. If "Progress Indicator" is checked on then a message will be displayed to the user while reading the file from disk. This is recommended for larger reports to let the user know that the program is still active while reading the file from disk. While reading the file from disk, the scrolling keys may be used (PgUp, PgDn, Up, Dn, etc...) to scroll the queue. The mouse cursor will not be active until the entire file has been read. No changes are required in the Screen Formatter or the Data Section. To use the template, just indicate the name of the DOS file to display. Formatter Support The Screen Formatter is available for this template and is preloaded with a default SCREEN. The LIST box and Exit button are required. The LIST box may be resized or positioned. The SCREEN has three pushbuttons: "Exit," "Print" and "25/50 Mode." The Exit button is required and may not be removed. The field equate label must be ?Exit. The Print button prints the file being viewed. A print device field is activated to allow the user to select the output device. If the Print button is deleted, the PrintDevice field must also be deleted. The 25/50 Mode button attempts to toggle the current text mode between 25 and 50 line mode. The SCREEN will be re-opened in the new mode and the listbox will be expanded, since the screen structure in the default application file has an EXPAND attribute with row 10 identified as the row to duplicate. Since the SETTEXT command is used, the mode will be changed to the closest match. For EGA systems the closest match to 50 line mode will be 43 line mode. This button may be removed from the SCREEN structure to disable video mode switching. The Report Formatter is not available. Property Fields < File to View: > File to View: This is the ASCII file to be displayed in the list box. It may be a string constant or a variable. If it is a constant it should be enclosed in 'quotes'. If it is a variable, the variable should be declared in the Global Data Section of the program. When left blank, a variable from the default application is used (GLO:Filespec in CLARION.APP). This is the same default variable used in the File template. < Warning Size (in K): > Warning Size (in K): The View template will read the entire file into a Queue for runtime performance. However, If you have a file larger than the assigned virtual memory block (Queue elements are saved in virtual by default unless virtual memory support is turned off) the Queue may be written to disk. This may substantially slow the scrolling of the file. A warning screen may be displayed when a selected file is larger than a specified size. This size will be multiplied by 1024 and compared against the actual file size. < Maximum Line Length: > Maximum Line Length: Most reports will not be wider than 80 or 132 columns. This allows an opportunity to check for files which do not typically have a carriage return / line feed combination in the first X number of characters. (like .EXE and .COM files) The number entered here will be used to check the number of bytes in each ASCII file record as it is read. If a line read has more than the number of characters which are specified as the maximum, an error window will appear and the view will be aborted. Typically for an .EXE file this will occur in the first record read and no 'garbage' will be displayed in the listbox. If no Maximum Line Length is entered, the default of 200 is used. < Progress Indicator > [û] Progress Indicator If this box is checked on, a message will be displayed to the user while the file is read from disk. < Progress Character:> Progress Character: You may enter the ASCII character to be used as the 'bar.' Easy entry of high order ascii characters may be made by using the ASCII value found in the ASCII chart from the Tools menu. The ASCII value should be surrounded by angle brackets within single quotes. The Default Application file is preloaded with a shaded bar character '<176>'. Embedded Source < Data Section > "Data Section" In the data section of the procedure before local data, the screen and pulldown structures. This may be used to declare any data which you may want to use only in your embedded source code. < Setup Procedure > "Setup Procedure" After the CODE statement. < Setup Screen > "Setup Screen" After OPEN(Screen). < Top of Accept Loop> "Top of Accept Loop" At the top of the screen field processing loop. < Immediately Before RETURN for non-ASCII file error> "Immediately Before RETURN for non-ASCII file error" When the procedure detects that a line is longer than the maximum specified by the Warning Size it returns to the caller with an error message. < After NEXT in RptFile Loop > "After NEXT in RptFile Loop" In the loop that read the DOS file from disk, after the NEXT statement. < Immediately After LOOP, before FREE(Queue)> "Immediately After LOOP, before FREE(Queue)" After the screen processing loop is complete, indicating the user is finished viewing the text. The queue still contains the text at this point. < End of Procedure > "End of Procedure" Code placed in this window executes after all other code in the procedure has executed. This code begins in column one, therefore you may use this window to write any ROUTINEs which are called from any other embedded source code window or code that should be execute at the end of the procedure. < When Screen Field is Selected : > "When Screen Field is Selected : " In the CASE SELECTED() structure, executed when the field is selected for entry. < When Screen Field is Completed: > "When Screen Field is Completed: " In the CASE FIELD() structure, executed when the field has been completed. Formula Classes No formula classes are supported by this procedure Template. Formula fields are not supported.